1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495
|
Description: Upstream changes introduced in version 3.5.4.Final-4
This patch has been created by dpkg-source during the package build.
Here's the last changelog entry, hopefully it gives details on why
those changes were made:
.
libhibernate3-java (3.5.4.Final-4) unstable; urgency=medium
.
[ Miguel Landaeta ]
* debian/rules: Fix clean target. (Closes: #594145).
* Bump Standards-Version to 3.9.1. No changes were required.
.
[ Torsten Werner ]
* Add javadocs. (Closes: #594441)
* Set urgency to medium because we are fixing RC and documentation bugs.
* Update Vcs headers in debian/control to match reality.
.
The person named in the Author field signed this changelog entry.
Author: Torsten Werner <twerner@debian.org>
Bug-Debian: http://bugs.debian.org/594145
Bug-Debian: http://bugs.debian.org/594441
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- libhibernate3-java-3.5.4.Final.orig/changelog.txt
+++ libhibernate3-java-3.5.4.Final/changelog.txt
@@ -5,81 +5,6 @@ match the actual issue resolution (i.e.
refer to the particular case on JIRA using the issue tracking number to learn
more about each case.
-Changes in version 3.5.4 (2010.07.21)
--------------------------------------------
-http://opensource.atlassian.com/projects/hibernate/browse/HHH/fixforversion/11100
-
-** Bug
-
- * [HHH-2269] - Many-to-one cascade fails with TransientObjectException if the inverse collection is marked CascadeType.DELETE_ORPHAN
- * [HHH-3001] - The NoopOptimizer is not thread safe
- * [HHH-3694] - ResultTransformer not used when scroll() is used on a named SQLQuery
- * [HHH-4156] - c3p0 is not used when only specific hibernate.c3p0.* properties
- * [HHH-4240] - SecondaryTables not recognized when using JOINED inheritance
- * [HHH-4250] - @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
- * [HHH-4568] - Sybase - Test "BatchTest" fails due to "unexpected row count from update"
- * [HHH-4647] - Problems with @JoinColumn referencedColumnName and quoted column and table names
- * [HHH-4716] - NotAuditedException using the entity name concept of hibernate.
- * [HHH-5109] - @OneToOne - too many joins
- * [HHH-5272] - Typo in tutorial at web site
- * [HHH-5315] - AuditJoinTable rows are no longer flushed to the database
- * [HHH-5318] - Wrong logic for RequiresDialectFeature in org.hibernate.test.annotations.HibernateTestCase
- * [HHH-5319] - Clean up data created in org.hibernate.test.annotations.onetomany.OneToManyTest#testUnidirectionalExplicit
- * [HHH-5320] - IntermediateMappedSuperclassTest should set the scale of the BigDecimal
- * [HHH-5322] - Regression in PersistenceUtilHelper
- * [HHH-5323] - correct jdbc driver version for testing
- * [HHH-5324] - Tests fail on mysql
- * [HHH-5329] - NoClassDefFoundError when using Hibernate 3.5 with J2SE 1.4 because of a wrong catch block
- * [HHH-5332] - JndiInfinispanRegionFactory cannot be instantiated
- * [HHH-5334] - PersistenceUtilHelpe.findMember(Class, String) private method doesn't work with members of a superclass
- * [HHH-5340] - Typo in tutorial at web site
- * [HHH-5370] - Building IN condition with CriteriaBuilder providing collection of values not working.
- * [HHH-5402] - Revert to hsqldb 1.8.0.2 as the test version for 3.5.4
-
-** New Feature
-
- * [HHH-3659] - statistics: Execution time of a query
- * [HHH-5260] - Allow query region name specific eviction settings
-
-** Patch
-
- * [HHH-5213] - Add native SQL Boolean type to Ingres10Dialect
- * [HHH-5336] - a few typo fixes
- * [HHH-5381] - HSQLDB new dialect (Fred Toussi)
-
-
-Changes in version 3.5.3 (2010.06.16)
--------------------------------------------
-http://opensource.atlassian.com/projects/hibernate/browse/HHH/fixforversion/11051
-
-** Bug
- * [HHH-4036] - EntityMetamodel entityNameByInheritenceClassNameMap field used inconsistently
- * [HHH-4968] - Cannot deactivate default BeanValidationListener independently of DDL constraints generation (Vladimir Klyushnikov)
- * [HHH-5094] - PersistenceUtilHelper cannot access non-public fields/methods (it should be able to)
- * [HHH-5098] - AssertionFailure thrown when collection contains a parameterized type
- * [HHH-5191] - CollectionMetadataGenerator fails to obtain mappedBy attribute when is defined on superclasses
- * [HHH-5195] - FilterImpl.validate() throws NullPointerExeption on deserialization
- * [HHH-5204] - Introduce @RequiresDialectFeature annotation
- * [HHH-5220] - Unit tests related to HHH-5063 and HHH-5135 fail on some dialects
- * [HHH-5230] - Regresion! @SequenceGenerator with allocationSize=1 fails Other allocationSizes appear to be decremented by 1
- * [HHH-5231] - Unit test failures lock up when they run on DB2 and PostgreSQL
- * [HHH-5253] - TableHiLoGenerator does not increment hi-value any more when lo-range es exhausted
- * [HHH-5258] - Persistence.isLoaded(Object, String) fails if the annotated property does not have a public getter or field
- * [HHH-5286] - Jar Scanner instances cannot be passed to EntityManagerFactory creation method
- * [HHH-5288] - Envers auditReader.find() returns wrong data for embedded components using fields with default values
- * [HHH-5298] - @AuditMappedBy doesn't work on an inherited relation
-
-** Improvement
- * [HHH-5251] - NativeSQLQueryReturn impls pre-cache a final hashcode based on non-final fields
- * [HHH-5252] - AttributeFactory needs more info in AssertionFailure
-
-** Patch
- * [HHH-3220] - Patch to prevent "org.hibernate.AssertionFailure: possible non-threadsafe access to the session" error caused by stateless sessions
-
-** Task
- * [HHH-5281] - TypeSafeActivator should also generate constraints for @Length
- * [HHH-5312] - update the db account used in branch 35 test
-
Changes in version 3.5.2 (2010.05.13)
-------------------------------------------
--- libhibernate3-java-3.5.4.Final.orig/pom.xml
+++ libhibernate3-java-3.5.4.Final/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/tutorials/pom.xml
+++ libhibernate3-java-3.5.4.Final/tutorials/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/tutorials/eg/pom.xml
+++ libhibernate3-java-3.5.4.Final/tutorials/eg/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tutorials</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/tutorials/web/pom.xml
+++ libhibernate3-java-3.5.4.Final/tutorials/web/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tutorials</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/documentation/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/src/main/docbook/en-US/content/tutorial.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/src/main/docbook/en-US/content/tutorial.xml
@@ -140,7 +140,7 @@
<tip>
<para>
It is not a requirement to use Maven. If you wish to use something else to
- build this tutorial (such as Ant), the layout will remain the same. The only
+ build this tutoial (such as Ant), the layout will remain the same. The only
change is that you will need to manually account for all the needed
dependencies. If you use something like <ulink url="http://ant.apache.org/ivy/">Ivy</ulink>
providing transitive dependency management you would still use the dependencies
@@ -674,7 +674,7 @@ public class HibernateUtil {
<title>Loading and storing objects</title>
<para>
- We are now ready to start doing some real work with Hibernate.
+ We are now ready to start doing some real worjk with Hibernate.
Let's start by writing an <literal>EventManager</literal> class
with a <literal>main()</literal> method:
</para>
@@ -723,7 +723,7 @@ public class EventManager {
<para>
A <interface>org.hibernate.Session</interface> is designed to
- represent a single unit of work (a single atomic piece of work
+ represent a single unit of work (a single atmoic piece of work
to be performed). For now we will keep things simple and assume
a one-to-one granularity between a Hibernate
<interface>org.hibernate.Session</interface> and a database
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml
@@ -1113,7 +1113,7 @@
node="element-name|."
<key-property name="propertyName" type="typename" column="column_name"/>
- <key-many-to-one name="propertyName" class="ClassName" column="column_name"/>
+ <key-many-to-one name="propertyName class="ClassName" column="column_name"/>
......
</composite-id>]]></programlisting>
@@ -1856,7 +1856,7 @@
associated object. The meaningful values are divided into three categories. First, basic
operations, which include: <literal>persist, merge, delete, save-update, evict, replicate, lock and
refresh</literal>; second, special values: <literal>delete-orphan</literal>;
- and third, <literal>all</literal> comma-separated combinations of operation
+ and third,<literal>all</literal> comma-separated combinations of operation
names: <literal>cascade="persist,merge,evict"</literal> or
<literal>cascade="all,delete-orphan"</literal>. See <xref linkend="objectstate-transitive"/>
for a full explanation. Note that single valued, many-to-one and
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/src/main/docbook/en-US/content/configuration.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/src/main/docbook/en-US/content/configuration.xml
@@ -604,7 +604,7 @@ hibernate.dialect = org.hibernate.dialec
</entry>
<entry>
Set this property to <literal>true</literal> if your JDBC driver returns
- correct row counts from <literal>executeBatch()</literal>. It is usually
+ correct row counts from <literal>executeBatch()</literal>. Iit is usually
safe to turn this option on. Hibernate will then use batched DML for
automatically versioned data. Defaults to <literal>false</literal>.
<para>
@@ -1674,7 +1674,7 @@ hibernate.dialect = org.hibernate.dialec
<literal>Session</literal> associated with the current JTA transaction, one will
be started and associated with that JTA transaction the first time you call
<literal>sessionFactory.getCurrentSession()</literal>. The <literal>Session</literal>s
- retrieved via <literal>getCurrentSession()</literal> in the <literal>"jta"</literal> context
+ retrieved via <literal>getCurrentSession()</literal> in the<literal>"jta"</literal> context
are set to automatically flush before the transaction completes, close
after the transaction completes, and aggressively release JDBC connections
after each statement. This allows the <literal>Session</literal>s to
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/pt-BR/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/pt-BR/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/ja-JP/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/ja-JP/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/fr-FR/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/fr-FR/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/ko-KR/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/ko-KR/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/zh-CN/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/zh-CN/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/manual/old/es-ES/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/manual/old/es-ES/pom.xml
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
--- libhibernate3-java-3.5.4.Final.orig/documentation/envers/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/envers/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/documentation/jbosscache2/pom.xml
+++ libhibernate3-java-3.5.4.Final/documentation/jbosscache2/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/cache-jbosscache/pom.xml
+++ libhibernate3-java-3.5.4.Final/cache-jbosscache/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/testing/pom.xml
+++ libhibernate3-java-3.5.4.Final/testing/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java
+++ libhibernate3-java-3.5.4.Final/testing/src/main/java/org/hibernate/test/annotations/HibernateTestCase.java
@@ -1,3 +1,4 @@
+// $Id: HibernateTestCase.java 19255 2010-04-21 01:57:44Z steve.ebersole@jboss.com $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -29,6 +30,8 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.HashSet;
+import java.util.Set;
import junit.framework.TestCase;
import org.slf4j.Logger;
@@ -37,10 +40,8 @@ import org.slf4j.LoggerFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect;
import org.hibernate.jdbc.Work;
-import org.hibernate.junit.DialectChecks;
import org.hibernate.junit.FailureExpected;
import org.hibernate.junit.RequiresDialect;
-import org.hibernate.junit.RequiresDialectFeature;
import org.hibernate.junit.SkipForDialect;
import org.hibernate.junit.SkipLog;
import org.hibernate.tool.hbm2ddl.SchemaExport;
@@ -59,6 +60,23 @@ public abstract class HibernateTestCase
protected static Configuration cfg;
private static Class<?> lastTestClass;
+
+ /**
+ * Flag indicating whether the test should be run or skipped.
+ */
+ private boolean runTest = true;
+
+ /**
+ * List of required dialect for the current {@code runMethod}. If the list is empty any dialect is allowed.
+ * Otherwise the current dialect or a superclass of the current dialect must be in the list.
+ */
+ private final Set<Class<? extends Dialect>> requiredDialectList = new HashSet<Class<? extends Dialect>>();
+
+ /**
+ * List of dialects for which the current {@code runMethod} should be skipped.
+ */
+ private final Set<Class<? extends Dialect>> skipForDialectList = new HashSet<Class<? extends Dialect>>();
+
public HibernateTestCase() {
super();
}
@@ -154,7 +172,7 @@ public abstract class HibernateTestCase
}
}
- protected final Skip determineSkipByDialect(Dialect dialect, Method runMethod) throws Exception {
+ protected final Skip determineSkipByDialect(Dialect dialect, Method runMethod) {
// skips have precedence, so check them first
SkipForDialect skipForDialectAnn = locateAnnotation( SkipForDialect.class, runMethod );
if ( skipForDialectAnn != null ) {
@@ -177,28 +195,18 @@ public abstract class HibernateTestCase
if ( requiresDialectAnn != null ) {
for ( Class<? extends Dialect> dialectClass : requiresDialectAnn.value() ) {
if ( requiresDialectAnn.strictMatching() ) {
- if ( !dialectClass.equals( dialect.getClass() ) ) {
+ if ( dialectClass.equals( dialect.getClass() ) ) {
return buildSkip( dialect, null, null );
}
}
else {
- if ( !dialectClass.isInstance( dialect ) ) {
- return buildSkip( dialect, requiresDialectAnn.comment(), requiresDialectAnn.jiraKey() );
+ if ( dialectClass.isInstance( dialect ) ) {
+ return buildSkip( dialect, null, null );
}
}
}
}
- // then check against a dialect feature
- RequiresDialectFeature requiresDialectFeatureAnn = locateAnnotation( RequiresDialectFeature.class, runMethod );
- if ( requiresDialectFeatureAnn != null ) {
- Class<? extends DialectChecks> checkClass = requiresDialectFeatureAnn.value();
- DialectChecks check = checkClass.newInstance();
- boolean skip = !check.include( dialect );
- if ( skip ) {
- return buildSkip( dialect, requiresDialectFeatureAnn.comment(), requiresDialectFeatureAnn.jiraKey() );
- }
- }
return null;
}
@@ -236,6 +244,30 @@ public abstract class HibernateTestCase
return this.getClass().getName() + "#" + this.getName();
}
+ protected boolean runForCurrentDialect() {
+ boolean runTestForCurrentDialect = true;
+
+ // check whether the current dialect is assignableFrom from any of the specified required dialects.
+ for ( Class<? extends Dialect> dialect : requiredDialectList ) {
+ if ( dialect.isAssignableFrom( Dialect.getDialect().getClass() ) ) {
+ runTestForCurrentDialect = true;
+ break;
+ }
+ runTestForCurrentDialect = false;
+ }
+
+ // check whether the current dialect is assignableFrom from any of the specified skip for dialects.
+ for ( Class<? extends Dialect> dialect : skipForDialectList ) {
+ if ( dialect.isAssignableFrom( Dialect.getDialect().getClass() ) ) {
+ runTestForCurrentDialect = false;
+ break;
+ }
+ runTestForCurrentDialect = true;
+ }
+
+ return runTestForCurrentDialect;
+ }
+
private Method findTestMethod() {
String fName = getName();
assertNotNull( fName );
@@ -257,7 +289,7 @@ public abstract class HibernateTestCase
protected abstract Class<?>[] getAnnotatedClasses();
protected String[] getMappings() {
- return new String[] { };
+ return new String[]{};
}
protected abstract void handleUnclosedResources();
--- libhibernate3-java-3.5.4.Final.orig/testing/src/main/java/org/hibernate/junit/RequiresDialect.java
+++ libhibernate3-java-3.5.4.Final/testing/src/main/java/org/hibernate/junit/RequiresDialect.java
@@ -33,15 +33,14 @@ import org.hibernate.dialect.Dialect;
/**
* Annotation used to indicate that a test should be run only when run against the
* indicated dialects.
- *
+ *
* @author Hardy Ferentschik
*/
-@Target({ ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface RequiresDialect {
/**
* The dialects against which to run the test
- *
* @return The dialects
*/
Class<? extends Dialect>[] value();
@@ -49,22 +48,7 @@ public @interface RequiresDialect {
/**
* Used to indicate if the dialects should be matched strictly (classes equal) or
* non-strictly (instanceof).
- *
* @return Should strict matching be used?
*/
boolean strictMatching() default false;
-
- /**
- * Comment describing the reason why the dialect is required.
- *
- * @return The comment
- */
- String comment() default "";
-
- /**
- * The key of a JIRA issue which relates this this restriction
- *
- * @return The jira issue key
- */
- String jiraKey() default "";
}
--- libhibernate3-java-3.5.4.Final.orig/core/pom.xml
+++ libhibernate3-java-3.5.4.Final/core/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
+++ libhibernate3-java-3.5.4.Final/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
@@ -28,7 +28,6 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.hibernate.Hibernate;
-import org.hibernate.TestingDatabaseInfo;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
@@ -78,7 +77,10 @@ public class SequenceHiLoGeneratorTest e
//noinspection deprecation
generator.configure( Hibernate.LONG, properties, dialect );
- cfg = TestingDatabaseInfo.buildBaseConfiguration()
+ cfg = new Configuration()
+ .setProperty( Environment.DRIVER, "org.hsqldb.jdbcDriver" )
+ .setProperty( Environment.URL, "jdbc:hsqldb:." )
+ .setProperty( Environment.USER, "sa" )
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
cfg.addAuxiliaryDatabaseObject(
new SimpleAuxiliaryDatabaseObject(
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
+ * distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,20 +20,21 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
+ *
*/
package org.hibernate.connection;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.Map;
+import java.beans.Introspector;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,20 +51,17 @@ import org.hibernate.util.ReflectHelper;
* to choose either <tt>DriverManagerConnectionProvider</tt>,
* <tt>DatasourceConnectionProvider</tt>, <tt>C3P0ConnectionProvider</tt> or
* <tt>DBCPConnectionProvider</tt>.
- *
- * @author Gavin King
* @see ConnectionProvider
+ * @author Gavin King
*/
public final class ConnectionProviderFactory {
- private static final Logger log = LoggerFactory.getLogger( ConnectionProviderFactory.class );
+ private static final Logger log = LoggerFactory.getLogger(ConnectionProviderFactory.class);
/**
* Instantiate a <tt>ConnectionProvider</tt> using <tt>System</tt> properties.
- *
* @return The created connection provider.
- *
* @throws HibernateException
*/
public static ConnectionProvider newConnectionProvider() throws HibernateException {
@@ -73,11 +71,8 @@ public final class ConnectionProviderFac
/**
* Instantiate a <tt>ConnectionProvider</tt> using given properties.
* Method newConnectionProvider.
- *
* @param properties hibernate <tt>SessionFactory</tt> properties
- *
* @return ConnectionProvider
- *
* @throws HibernateException
*/
public static ConnectionProvider newConnectionProvider(Properties properties) throws HibernateException {
@@ -88,26 +83,27 @@ public final class ConnectionProviderFac
* Create a connection provider based on the given information.
*
* @param properties Properties being used to build the {@link org.hibernate.SessionFactory}.
- * @param connectionProviderInjectionData Something to be injected in the connection provided
- *
+ * @param connectionProviderInjectionData Soemthing to be injected in the conenction provided
* @return The created connection provider
- *
* @throws HibernateException
*/
- public static ConnectionProvider newConnectionProvider(Properties properties, Map connectionProviderInjectionData)
- throws HibernateException {
+ public static ConnectionProvider newConnectionProvider(Properties properties, Map connectionProviderInjectionData) throws HibernateException {
ConnectionProvider connections;
- String providerClass = properties.getProperty( Environment.CONNECTION_PROVIDER );
- if ( providerClass != null ) {
- connections = initializeConnectionProviderFromConfig( providerClass );
- }
- else if ( c3p0ConfigDefined( properties ) && c3p0ProviderPresent() ) {
- connections = initializeConnectionProviderFromConfig("org.hibernate.connection.C3P0ConnectionProvider");
+ String providerClass = properties.getProperty(Environment.CONNECTION_PROVIDER);
+ if ( providerClass!=null ) {
+ try {
+ log.info("Initializing connection provider: " + providerClass);
+ connections = (ConnectionProvider) ReflectHelper.classForName(providerClass).newInstance();
+ }
+ catch ( Exception e ) {
+ log.error( "Could not instantiate connection provider", e );
+ throw new HibernateException("Could not instantiate connection provider: " + providerClass);
+ }
}
- else if ( properties.getProperty( Environment.DATASOURCE ) != null ) {
+ else if ( properties.getProperty(Environment.DATASOURCE)!=null ) {
connections = new DatasourceConnectionProvider();
}
- else if ( properties.getProperty( Environment.URL ) != null ) {
+ else if ( properties.getProperty(Environment.URL)!=null ) {
connections = new DriverManagerConnectionProvider();
}
else {
@@ -120,71 +116,30 @@ public final class ConnectionProviderFac
BeanInfo info = Introspector.getBeanInfo( connections.getClass() );
PropertyDescriptor[] descritors = info.getPropertyDescriptors();
int size = descritors.length;
- for ( int index = 0; index < size; index++ ) {
+ for (int index = 0 ; index < size ; index++) {
String propertyName = descritors[index].getName();
if ( connectionProviderInjectionData.containsKey( propertyName ) ) {
Method method = descritors[index].getWriteMethod();
- method.invoke(
- connections, new Object[] { connectionProviderInjectionData.get( propertyName ) }
- );
+ method.invoke( connections, new Object[] { connectionProviderInjectionData.get( propertyName ) } );
}
}
}
- catch ( IntrospectionException e ) {
- throw new HibernateException( "Unable to inject objects into the connection provider", e );
+ catch (IntrospectionException e) {
+ throw new HibernateException("Unable to inject objects into the conenction provider", e);
}
- catch ( IllegalAccessException e ) {
- throw new HibernateException( "Unable to inject objects into the connection provider", e );
+ catch (IllegalAccessException e) {
+ throw new HibernateException("Unable to inject objects into the conenction provider", e);
}
- catch ( InvocationTargetException e ) {
- throw new HibernateException( "Unable to inject objects into the connection provider", e );
+ catch (InvocationTargetException e) {
+ throw new HibernateException("Unable to inject objects into the conenction provider", e);
}
}
- connections.configure( properties );
- return connections;
- }
-
- private static boolean c3p0ProviderPresent() {
- try {
- ReflectHelper.classForName( "org.hibernate.connection.C3P0ConnectionProvider" );
- }
- catch ( ClassNotFoundException e ) {
- log.warn( "c3p0 properties is specificed, but could not find org.hibernate.connection.C3P0ConnectionProvider from the classpath, " +
- "these properties are going to be ignored." );
- return false;
- }
- return true;
- }
-
- private static boolean c3p0ConfigDefined(Properties properties) {
- Iterator iter = properties.keySet().iterator();
- while ( iter.hasNext() ) {
- String property = (String) iter.next();
- if ( property.startsWith( "hibernate.c3p0" ) ) {
- return true;
- }
- }
- return false;
- }
-
- private static ConnectionProvider initializeConnectionProviderFromConfig(String providerClass) {
- ConnectionProvider connections;
- try {
- log.info( "Initializing connection provider: " + providerClass );
- connections = (ConnectionProvider) ReflectHelper.classForName( providerClass ).newInstance();
- }
- catch ( Exception e ) {
- log.error( "Could not instantiate connection provider", e );
- throw new HibernateException( "Could not instantiate connection provider: " + providerClass );
- }
+ connections.configure(properties);
return connections;
}
// cannot be instantiated
-
- private ConnectionProviderFactory() {
- throw new UnsupportedOperationException();
- }
+ private ConnectionProviderFactory() { throw new UnsupportedOperationException(); }
/**
* Transform JDBC connection properties.
@@ -198,31 +153,28 @@ public final class ConnectionProviderFac
Properties result = new Properties();
while ( iter.hasNext() ) {
String prop = (String) iter.next();
- if ( prop.startsWith( Environment.CONNECTION_PREFIX ) && !SPECIAL_PROPERTIES.contains( prop ) ) {
+ if ( prop.startsWith(Environment.CONNECTION_PREFIX) && !SPECIAL_PROPERTIES.contains(prop) ) {
result.setProperty(
- prop.substring( Environment.CONNECTION_PREFIX.length() + 1 ),
- properties.getProperty( prop )
+ prop.substring( Environment.CONNECTION_PREFIX.length()+1 ),
+ properties.getProperty(prop)
);
}
}
- String userName = properties.getProperty( Environment.USER );
- if ( userName != null ) {
- result.setProperty( "user", userName );
- }
+ String userName = properties.getProperty(Environment.USER);
+ if (userName!=null) result.setProperty( "user", userName );
return result;
}
private static final Set SPECIAL_PROPERTIES;
-
static {
SPECIAL_PROPERTIES = new HashSet();
- SPECIAL_PROPERTIES.add( Environment.DATASOURCE );
- SPECIAL_PROPERTIES.add( Environment.URL );
- SPECIAL_PROPERTIES.add( Environment.CONNECTION_PROVIDER );
- SPECIAL_PROPERTIES.add( Environment.POOL_SIZE );
- SPECIAL_PROPERTIES.add( Environment.ISOLATION );
- SPECIAL_PROPERTIES.add( Environment.DRIVER );
- SPECIAL_PROPERTIES.add( Environment.USER );
+ SPECIAL_PROPERTIES.add(Environment.DATASOURCE);
+ SPECIAL_PROPERTIES.add(Environment.URL);
+ SPECIAL_PROPERTIES.add(Environment.CONNECTION_PROVIDER);
+ SPECIAL_PROPERTIES.add(Environment.POOL_SIZE);
+ SPECIAL_PROPERTIES.add(Environment.ISOLATION);
+ SPECIAL_PROPERTIES.add(Environment.DRIVER);
+ SPECIAL_PROPERTIES.add(Environment.USER);
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/id/TableHiLoGenerator.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/id/TableHiLoGenerator.java
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
+ * distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,16 +20,17 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
+ *
*/
package org.hibernate.id;
import java.io.Serializable;
import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionImplementor;
-import org.hibernate.id.enhanced.AccessCallback;
-import org.hibernate.id.enhanced.OptimizerFactory;
import org.hibernate.type.Type;
import org.hibernate.util.PropertiesHelper;
@@ -37,7 +38,7 @@ import org.hibernate.util.PropertiesHelp
* <b>hilo</b><br>
* <br>
* An <tt>IdentifierGenerator</tt> that returns a <tt>Long</tt>, constructed using
- * a hi/lo algorithm. The hi value MUST be fetched in a separate transaction
+ * a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction
* to the <tt>Session</tt> transaction so the generator must be able to obtain
* a new connection and commit it. Hence this implementation may not
* be used when the user is supplying connections. In this
@@ -50,25 +51,26 @@ import org.hibernate.util.PropertiesHelp
* @author Gavin King
*/
public class TableHiLoGenerator extends TableGenerator {
+
/**
* The max_lo parameter
*/
public static final String MAX_LO = "max_lo";
- private OptimizerFactory.LegacyHiLoAlgorithmOptimizer hiloOptimizer;
-
private int maxLo;
+ private int lo;
+
+ private IntegralDataTypeHolder value;
+
+ private static final Logger log = LoggerFactory.getLogger(TableHiLoGenerator.class);
public void configure(Type type, Properties params, Dialect d) {
super.configure(type, params, d);
maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE);
-
- if ( maxLo >= 1 ) {
- hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer( type.getReturnedClass(), maxLo );
- }
+ lo = maxLo + 1; // so we "clock over" on the first invocation
}
- public synchronized Serializable generate(final SessionImplementor session, Object obj) {
+ public synchronized Serializable generate(SessionImplementor session, Object obj) {
// maxLo < 1 indicates a hilo generator with no hilo :?
if ( maxLo < 1 ) {
//keep the behavior consistent even for boundary usages
@@ -79,13 +81,16 @@ public class TableHiLoGenerator extends
return value.makeValue();
}
- return hiloOptimizer.generate(
- new AccessCallback() {
- public IntegralDataTypeHolder getNextValue() {
- return generateHolder( session );
- }
- }
- );
+ if ( lo > maxLo ) {
+ IntegralDataTypeHolder hiVal = generateHolder( session );
+ lo = ( hiVal.eq( 0 ) ) ? 1 : 0;
+ value = hiVal.copy().multiplyBy( maxLo+1 ).add( lo );
+ if ( log.isDebugEnabled() ) {
+ log.debug("new hi value: " + hiVal);
+ }
+ }
+
+ return value.makeValueThenIncrement();
}
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
@@ -61,12 +61,10 @@ public class SequenceHiLoGenerator exten
maxLo = PropertiesHelper.getInt( MAX_LO, params, 9 );
- if ( maxLo >= 1 ) {
- hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
- getIdentifierType().getReturnedClass(),
- maxLo
- );
- }
+ hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
+ getIdentifierType().getReturnedClass(),
+ maxLo
+ );
}
public synchronized Serializable generate(final SessionImplementor session, Object obj) {
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java
@@ -186,14 +186,15 @@ public class OptimizerFactory {
* {@inheritDoc}
*/
public Serializable generate(AccessCallback callback) {
- // IMPL NOTE : it is incredibly important that the method-local variable be used here to
- // avoid concurrency issues.
- IntegralDataTypeHolder value = null;
- while ( value == null || value.lt( 1 ) ) {
- value = callback.getNextValue();
+ if ( lastSourceValue == null ) {
+ do {
+ lastSourceValue = callback.getNextValue();
+ } while ( lastSourceValue.lt( 1 ) );
}
- lastSourceValue = value;
- return value.makeValue();
+ else {
+ lastSourceValue = callback.getNextValue();
+ }
+ return lastSourceValue.makeValue();
}
/**
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
@@ -1,781 +1,635 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.persister.entity;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.Hibernate;
-import org.hibernate.HibernateException;
-import org.hibernate.MappingException;
-import org.hibernate.QueryException;
-import org.hibernate.cache.access.EntityRegionAccessStrategy;
-import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
-import org.hibernate.engine.Mapping;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.engine.Versioning;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Join;
-import org.hibernate.mapping.KeyValue;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.Selectable;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.sql.CaseFragment;
-import org.hibernate.sql.SelectFragment;
-import org.hibernate.type.AbstractType;
-import org.hibernate.type.Type;
-import org.hibernate.util.ArrayHelper;
-
-/**
- * An <tt>EntityPersister</tt> implementing the normalized "table-per-subclass"
- * mapping strategy
- *
- * @author Gavin King
- */
-public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
-
- // the class hierarchy structure
- private final int tableSpan;
- private final String[] tableNames;
- private final String[] naturalOrderTableNames;
- private final String[][] tableKeyColumns;
- private final String[][] tableKeyColumnReaders;
- private final String[][] tableKeyColumnReaderTemplates;
- private final String[][] naturalOrderTableKeyColumns;
- private final String[][] naturalOrderTableKeyColumnReaders;
- private final String[][] naturalOrderTableKeyColumnReaderTemplates;
- private final boolean[] naturalOrderCascadeDeleteEnabled;
-
- private final String[] spaces;
-
- private final String[] subclassClosure;
-
- private final String[] subclassTableNameClosure;
- private final String[][] subclassTableKeyColumnClosure;
- private final boolean[] isClassOrSuperclassTable;
-
- // properties of this class, including inherited properties
- private final int[] naturalOrderPropertyTableNumbers;
- private final int[] propertyTableNumbers;
-
- // the closure of all properties in the entire hierarchy including
- // subclasses and superclasses of this class
- private final int[] subclassPropertyTableNumberClosure;
-
- // the closure of all columns used by the entire hierarchy including
- // subclasses and superclasses of this class
- private final int[] subclassColumnTableNumberClosure;
- private final int[] subclassFormulaTableNumberClosure;
-
- private final boolean[] subclassTableSequentialSelect;
- private final boolean[] subclassTableIsLazyClosure;
-
- // subclass discrimination works by assigning particular
- // values to certain combinations of null primary key
- // values in the outer join using an SQL CASE
- private final Map subclassesByDiscriminatorValue = new HashMap();
- private final String[] discriminatorValues;
- private final String[] notNullColumnNames;
- private final int[] notNullColumnTableNumbers;
-
- private final String[] constraintOrderedTableNames;
- private final String[][] constraintOrderedKeyColumnNames;
-
- private final String discriminatorSQLString;
-
- //INITIALIZATION:
-
- public JoinedSubclassEntityPersister(
- final PersistentClass persistentClass,
- final EntityRegionAccessStrategy cacheAccessStrategy,
- final SessionFactoryImplementor factory,
- final Mapping mapping) throws HibernateException {
-
- super( persistentClass, cacheAccessStrategy, factory );
-
- // DISCRIMINATOR
-
- final Object discriminatorValue;
- if ( persistentClass.isPolymorphic() ) {
- try {
- discriminatorValue = new Integer( persistentClass.getSubclassId() );
- discriminatorSQLString = discriminatorValue.toString();
- }
- catch (Exception e) {
- throw new MappingException("Could not format discriminator value to SQL string", e );
- }
- }
- else {
- discriminatorValue = null;
- discriminatorSQLString = null;
- }
-
- if ( optimisticLockMode() > Versioning.OPTIMISTIC_LOCK_VERSION ) {
- throw new MappingException( "optimistic-lock=all|dirty not supported for joined-subclass mappings [" + getEntityName() + "]" );
- }
-
- //MULTITABLES
-
- final int idColumnSpan = getIdentifierColumnSpan();
-
- ArrayList tables = new ArrayList();
- ArrayList keyColumns = new ArrayList();
- ArrayList keyColumnReaders = new ArrayList();
- ArrayList keyColumnReaderTemplates = new ArrayList();
- ArrayList cascadeDeletes = new ArrayList();
- Iterator titer = persistentClass.getTableClosureIterator();
- Iterator kiter = persistentClass.getKeyClosureIterator();
- while ( titer.hasNext() ) {
- Table tab = (Table) titer.next();
- KeyValue key = (KeyValue) kiter.next();
- String tabname = tab.getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- tables.add(tabname);
- String[] keyCols = new String[idColumnSpan];
- String[] keyColReaders = new String[idColumnSpan];
- String[] keyColReaderTemplates = new String[idColumnSpan];
- Iterator citer = key.getColumnIterator();
- for ( int k=0; k<idColumnSpan; k++ ) {
- Column column = (Column) citer.next();
- keyCols[k] = column.getQuotedName( factory.getDialect() );
- keyColReaders[k] = column.getReadExpr( factory.getDialect() );
- keyColReaderTemplates[k] = column.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
- }
- keyColumns.add(keyCols);
- keyColumnReaders.add(keyColReaders);
- keyColumnReaderTemplates.add(keyColReaderTemplates);
- cascadeDeletes.add( new Boolean( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() ) );
- }
-
- //Span of the tables directly mapped by this entity and super-classes, if any
- int coreTableSpan = tables.size();
-
- Iterator joinIter = persistentClass.getJoinClosureIterator();
- while ( joinIter.hasNext() ) {
- Join join = (Join) joinIter.next();
-
- Table tab = join.getTable();
-
- String tabname = tab.getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- tables.add(tabname);
-
- KeyValue key = join.getKey();
- int joinIdColumnSpan = key.getColumnSpan();
-
- String[] keyCols = new String[joinIdColumnSpan];
- String[] keyColReaders = new String[joinIdColumnSpan];
- String[] keyColReaderTemplates = new String[joinIdColumnSpan];
-
- Iterator citer = key.getColumnIterator();
-
- for ( int k=0; k<joinIdColumnSpan; k++ ) {
- Column column = (Column) citer.next();
- keyCols[k] = column.getQuotedName( factory.getDialect() );
- keyColReaders[k] = column.getReadExpr( factory.getDialect() );
- keyColReaderTemplates[k] = column.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
- }
- keyColumns.add(keyCols);
- keyColumnReaders.add(keyColReaders);
- keyColumnReaderTemplates.add(keyColReaderTemplates);
- cascadeDeletes.add( new Boolean( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() ) );
- }
-
- naturalOrderTableNames = ArrayHelper.toStringArray(tables);
- naturalOrderTableKeyColumns = ArrayHelper.to2DStringArray(keyColumns);
- naturalOrderTableKeyColumnReaders = ArrayHelper.to2DStringArray(keyColumnReaders);
- naturalOrderTableKeyColumnReaderTemplates = ArrayHelper.to2DStringArray(keyColumnReaderTemplates);
- naturalOrderCascadeDeleteEnabled = ArrayHelper.toBooleanArray(cascadeDeletes);
-
- ArrayList subtables = new ArrayList();
- ArrayList isConcretes = new ArrayList();
- ArrayList isDeferreds = new ArrayList();
- ArrayList isLazies = new ArrayList();
-
- keyColumns = new ArrayList();
- titer = persistentClass.getSubclassTableClosureIterator();
- while ( titer.hasNext() ) {
- Table tab = (Table) titer.next();
- isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassTable(tab) ) );
- isDeferreds.add(Boolean.FALSE);
- isLazies.add(Boolean.FALSE);
- String tabname = tab.getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- subtables.add(tabname);
- String[] key = new String[idColumnSpan];
- Iterator citer = tab.getPrimaryKey().getColumnIterator();
- for ( int k=0; k<idColumnSpan; k++ ) {
- key[k] = ( (Column) citer.next() ).getQuotedName( factory.getDialect() );
- }
- keyColumns.add(key);
- }
-
- //Add joins
- joinIter = persistentClass.getSubclassJoinClosureIterator();
- while ( joinIter.hasNext() ) {
- Join join = (Join) joinIter.next();
-
- Table tab = join.getTable();
-
- isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassTable(tab) ) );
- isDeferreds.add( new Boolean( join.isSequentialSelect() ) );
- isLazies.add(new Boolean(join.isLazy()));
-
- String tabname = tab.getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- subtables.add(tabname);
- String[] key = new String[idColumnSpan];
- Iterator citer = tab.getPrimaryKey().getColumnIterator();
- for ( int k=0; k<idColumnSpan; k++ ) {
- key[k] = ( (Column) citer.next() ).getQuotedName( factory.getDialect() );
- }
- keyColumns.add(key);
-
- }
-
- String [] naturalOrderSubclassTableNameClosure = ArrayHelper.toStringArray(subtables);
- String[][] naturalOrderSubclassTableKeyColumnClosure = ArrayHelper.to2DStringArray(keyColumns);
- isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
- subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
- subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
-
- constraintOrderedTableNames = new String[naturalOrderSubclassTableNameClosure.length];
- constraintOrderedKeyColumnNames = new String[naturalOrderSubclassTableNameClosure.length][];
- int currentPosition = 0;
- for ( int i = naturalOrderSubclassTableNameClosure.length - 1; i >= 0 ; i--, currentPosition++ ) {
- constraintOrderedTableNames[currentPosition] = naturalOrderSubclassTableNameClosure[i];
- constraintOrderedKeyColumnNames[currentPosition] = naturalOrderSubclassTableKeyColumnClosure[i];
- }
-
- /**
- * Suppose an entity Client extends Person, mapped to the tables CLIENT and PERSON respectively.
- * For the Client entity:
- * naturalOrderTableNames -> PERSON, CLIENT; this reflects the sequence in which the tables are
- * added to the meta-data when the annotated entities are processed.
- * However, in some instances, for example when generating joins, the CLIENT table needs to be
- * the first table as it will the driving table.
- * tableNames -> CLIENT, PERSON
- */
-
- tableSpan = naturalOrderTableNames.length;
- tableNames = reverse(naturalOrderTableNames, coreTableSpan);
- tableKeyColumns = reverse(naturalOrderTableKeyColumns, coreTableSpan);
- tableKeyColumnReaders = reverse(naturalOrderTableKeyColumnReaders, coreTableSpan);
- tableKeyColumnReaderTemplates = reverse(naturalOrderTableKeyColumnReaderTemplates, coreTableSpan);
- subclassTableNameClosure = reverse(naturalOrderSubclassTableNameClosure, coreTableSpan);
- subclassTableKeyColumnClosure = reverse(naturalOrderSubclassTableKeyColumnClosure, coreTableSpan);
-
- spaces = ArrayHelper.join(
- tableNames,
- ArrayHelper.toStringArray( persistentClass.getSynchronizedTables() )
- );
-
- // Custom sql
- customSQLInsert = new String[tableSpan];
- customSQLUpdate = new String[tableSpan];
- customSQLDelete = new String[tableSpan];
- insertCallable = new boolean[tableSpan];
- updateCallable = new boolean[tableSpan];
- deleteCallable = new boolean[tableSpan];
- insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
- updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
- deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
-
- PersistentClass pc = persistentClass;
- int jk = coreTableSpan-1;
- while (pc!=null) {
- customSQLInsert[jk] = pc.getCustomSQLInsert();
- insertCallable[jk] = customSQLInsert[jk] != null && pc.isCustomInsertCallable();
- insertResultCheckStyles[jk] = pc.getCustomSQLInsertCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[jk], insertCallable[jk] )
- : pc.getCustomSQLInsertCheckStyle();
- customSQLUpdate[jk] = pc.getCustomSQLUpdate();
- updateCallable[jk] = customSQLUpdate[jk] != null && pc.isCustomUpdateCallable();
- updateResultCheckStyles[jk] = pc.getCustomSQLUpdateCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[jk], updateCallable[jk] )
- : pc.getCustomSQLUpdateCheckStyle();
- customSQLDelete[jk] = pc.getCustomSQLDelete();
- deleteCallable[jk] = customSQLDelete[jk] != null && pc.isCustomDeleteCallable();
- deleteResultCheckStyles[jk] = pc.getCustomSQLDeleteCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[jk], deleteCallable[jk] )
- : pc.getCustomSQLDeleteCheckStyle();
- jk--;
- pc = pc.getSuperclass();
- }
-
- if ( jk != -1 ) {
- throw new AssertionFailure( "Tablespan does not match height of joined-subclass hiearchy." );
- }
-
- joinIter = persistentClass.getJoinClosureIterator();
- int j = coreTableSpan;
- while ( joinIter.hasNext() ) {
- Join join = (Join) joinIter.next();
-
- customSQLInsert[j] = join.getCustomSQLInsert();
- insertCallable[j] = customSQLInsert[j] != null && join.isCustomInsertCallable();
- insertResultCheckStyles[j] = join.getCustomSQLInsertCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[j], insertCallable[j] )
- : join.getCustomSQLInsertCheckStyle();
- customSQLUpdate[j] = join.getCustomSQLUpdate();
- updateCallable[j] = customSQLUpdate[j] != null && join.isCustomUpdateCallable();
- updateResultCheckStyles[j] = join.getCustomSQLUpdateCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[j], updateCallable[j] )
- : join.getCustomSQLUpdateCheckStyle();
- customSQLDelete[j] = join.getCustomSQLDelete();
- deleteCallable[j] = customSQLDelete[j] != null && join.isCustomDeleteCallable();
- deleteResultCheckStyles[j] = join.getCustomSQLDeleteCheckStyle() == null
- ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[j], deleteCallable[j] )
- : join.getCustomSQLDeleteCheckStyle();
- j++;
- }
-
- // PROPERTIES
- int hydrateSpan = getPropertySpan();
- naturalOrderPropertyTableNumbers = new int[hydrateSpan];
- propertyTableNumbers = new int[hydrateSpan];
- Iterator iter = persistentClass.getPropertyClosureIterator();
- int i=0;
- while( iter.hasNext() ) {
- Property prop = (Property) iter.next();
- String tabname = prop.getValue().getTable().getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- propertyTableNumbers[i] = getTableId(tabname, tableNames);
- naturalOrderPropertyTableNumbers[i] = getTableId(tabname, naturalOrderTableNames);
- i++;
- }
-
- // subclass closure properties
-
- //TODO: code duplication with SingleTableEntityPersister
-
- ArrayList columnTableNumbers = new ArrayList();
- ArrayList formulaTableNumbers = new ArrayList();
- ArrayList propTableNumbers = new ArrayList();
-
- iter = persistentClass.getSubclassPropertyClosureIterator();
- while ( iter.hasNext() ) {
- Property prop = (Property) iter.next();
- Table tab = prop.getValue().getTable();
- String tabname = tab.getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- );
- Integer tabnum = new Integer( getTableId(tabname, subclassTableNameClosure) );
- propTableNumbers.add(tabnum);
-
- Iterator citer = prop.getColumnIterator();
- while ( citer.hasNext() ) {
- Selectable thing = (Selectable) citer.next();
- if ( thing.isFormula() ) {
- formulaTableNumbers.add(tabnum);
- }
- else {
- columnTableNumbers.add(tabnum);
- }
- }
-
- }
-
- subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnTableNumbers);
- subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propTableNumbers);
- subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaTableNumbers);
-
- // SUBCLASSES
-
- int subclassSpan = persistentClass.getSubclassSpan() + 1;
- subclassClosure = new String[subclassSpan];
- subclassClosure[subclassSpan-1] = getEntityName();
- if ( persistentClass.isPolymorphic() ) {
- subclassesByDiscriminatorValue.put( discriminatorValue, getEntityName() );
- discriminatorValues = new String[subclassSpan];
- discriminatorValues[subclassSpan-1] = discriminatorSQLString;
- notNullColumnTableNumbers = new int[subclassSpan];
- final int id = getTableId(
- persistentClass.getTable().getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- ),
- subclassTableNameClosure
- );
- notNullColumnTableNumbers[subclassSpan-1] = id;
- notNullColumnNames = new String[subclassSpan];
- notNullColumnNames[subclassSpan-1] = subclassTableKeyColumnClosure[id][0]; //( (Column) model.getTable().getPrimaryKey().getColumnIterator().next() ).getName();
- }
- else {
- discriminatorValues = null;
- notNullColumnTableNumbers = null;
- notNullColumnNames = null;
- }
-
- iter = persistentClass.getSubclassIterator();
- int k=0;
- while ( iter.hasNext() ) {
- Subclass sc = (Subclass) iter.next();
- subclassClosure[k] = sc.getEntityName();
- try {
- if ( persistentClass.isPolymorphic() ) {
- // we now use subclass ids that are consistent across all
- // persisters for a class hierarchy, so that the use of
- // "foo.class = Bar" works in HQL
- Integer subclassId = new Integer( sc.getSubclassId() );//new Integer(k+1);
- subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() );
- discriminatorValues[k] = subclassId.toString();
- int id = getTableId(
- sc.getTable().getQualifiedName(
- factory.getDialect(),
- factory.getSettings().getDefaultCatalogName(),
- factory.getSettings().getDefaultSchemaName()
- ),
- subclassTableNameClosure
- );
- notNullColumnTableNumbers[k] = id;
- notNullColumnNames[k] = subclassTableKeyColumnClosure[id][0]; //( (Column) sc.getTable().getPrimaryKey().getColumnIterator().next() ).getName();
- }
- }
- catch (Exception e) {
- throw new MappingException("Error parsing discriminator value", e );
- }
- k++;
- }
-
- initLockers();
-
- initSubclassPropertyAliasesMap(persistentClass);
-
- postConstruct(mapping);
-
- }
-
- protected boolean isSubclassTableSequentialSelect(int j) {
- return subclassTableSequentialSelect[j] && !isClassOrSuperclassTable[j];
- }
-
-
- /*public void postInstantiate() throws MappingException {
- super.postInstantiate();
- //TODO: other lock modes?
- loader = createEntityLoader(LockMode.NONE, CollectionHelper.EMPTY_MAP);
- }*/
-
- public String getSubclassPropertyTableName(int i) {
- return subclassTableNameClosure[ subclassPropertyTableNumberClosure[i] ];
- }
-
- public Type getDiscriminatorType() {
- return Hibernate.INTEGER;
- }
-
- public String getDiscriminatorSQLValue() {
- return discriminatorSQLString;
- }
-
-
- public String getSubclassForDiscriminatorValue(Object value) {
- return (String) subclassesByDiscriminatorValue.get(value);
- }
-
- public Serializable[] getPropertySpaces() {
- return spaces; // don't need subclass tables, because they can't appear in conditions
- }
-
-
- protected String getTableName(int j) {
- return naturalOrderTableNames[j];
- }
-
- protected String[] getKeyColumns(int j) {
- return naturalOrderTableKeyColumns[j];
- }
-
- protected boolean isTableCascadeDeleteEnabled(int j) {
- return naturalOrderCascadeDeleteEnabled[j];
- }
-
- protected boolean isPropertyOfTable(int property, int j) {
- return naturalOrderPropertyTableNumbers[property]==j;
- }
-
- /**
- * Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>,
- * depending upon the value of the <tt>lock</tt> parameter
- */
- /*public Object load(Serializable id, Object optionalObject, LockMode lockMode, SessionImplementor session)
- throws HibernateException {
-
- if ( log.isTraceEnabled() ) log.trace( "Materializing entity: " + MessageHelper.infoString(this, id) );
-
- final UniqueEntityLoader loader = hasQueryLoader() ?
- getQueryLoader() :
- this.loader;
- try {
-
- final Object result = loader.load(id, optionalObject, session);
-
- if (result!=null) lock(id, getVersion(result), result, lockMode, session);
-
- return result;
-
- }
- catch (SQLException sqle) {
- throw new JDBCException( "could not load by id: " + MessageHelper.infoString(this, id), sqle );
- }
- }*/
-
- private static final void reverse(Object[] objects, int len) {
- Object[] temp = new Object[len];
- for (int i=0; i<len; i++) {
- temp[i] = objects[len-i-1];
- }
- for (int i=0; i<len; i++) {
- objects[i] = temp[i];
- }
- }
-
-
- /**
- * Reverse the first n elements of the incoming array
- * @param objects
- * @param n
- * @return New array with the first n elements in reversed order
- */
- private static final String[] reverse(String [] objects, int n) {
-
- int size = objects.length;
- String[] temp = new String[size];
-
- for (int i=0; i<n; i++) {
- temp[i] = objects[n-i-1];
- }
-
- for (int i=n; i < size; i++) {
- temp[i] = objects[i];
- }
-
- return temp;
- }
-
- /**
- * Reverse the first n elements of the incoming array
- * @param objects
- * @param n
- * @return New array with the first n elements in reversed order
- */
- private static final String[][] reverse(String[][] objects, int n) {
- int size = objects.length;
- String[][] temp = new String[size][];
- for (int i=0; i<n; i++) {
- temp[i] = objects[n-i-1];
- }
-
- for (int i=n; i<size; i++) {
- temp[i] = objects[i];
- }
-
- return temp;
- }
-
-
-
- public String fromTableFragment(String alias) {
- return getTableName() + ' ' + alias;
- }
-
- public String getTableName() {
- return tableNames[0];
- }
-
- private static int getTableId(String tableName, String[] tables) {
- for ( int j=0; j<tables.length; j++ ) {
- if ( tableName.equals( tables[j] ) ) {
- return j;
- }
- }
- throw new AssertionFailure("Table " + tableName + " not found");
- }
-
- public void addDiscriminatorToSelect(SelectFragment select, String name, String suffix) {
- if ( hasSubclasses() ) {
- select.setExtraSelectList( discriminatorFragment(name), getDiscriminatorAlias() );
- }
- }
-
- private CaseFragment discriminatorFragment(String alias) {
- CaseFragment cases = getFactory().getDialect().createCaseFragment();
-
- for ( int i=0; i<discriminatorValues.length; i++ ) {
- cases.addWhenColumnNotNull(
- generateTableAlias( alias, notNullColumnTableNumbers[i] ),
- notNullColumnNames[i],
- discriminatorValues[i]
- );
- }
-
- return cases;
- }
-
- public String filterFragment(String alias) {
- return hasWhere() ?
- " and " + getSQLWhereString( generateFilterConditionAlias( alias ) ) :
- "";
- }
-
- public String generateFilterConditionAlias(String rootAlias) {
- return generateTableAlias( rootAlias, tableSpan-1 );
- }
-
- public String[] getIdentifierColumnNames() {
- return tableKeyColumns[0];
- }
-
- public String[] getIdentifierColumnReaderTemplates() {
- return tableKeyColumnReaderTemplates[0];
- }
-
- public String[] getIdentifierColumnReaders() {
- return tableKeyColumnReaders[0];
- }
-
- public String[] toColumns(String alias, String propertyName) throws QueryException {
-
- if ( ENTITY_CLASS.equals(propertyName) ) {
- // This doesn't actually seem to work but it *might*
- // work on some dbs. Also it doesn't work if there
- // are multiple columns of results because it
- // is not accounting for the suffix:
- // return new String[] { getDiscriminatorColumnName() };
-
- return new String[] { discriminatorFragment(alias).toFragmentString() };
- }
- else {
- return super.toColumns(alias, propertyName);
- }
-
- }
-
- protected int[] getPropertyTableNumbersInSelect() {
- return propertyTableNumbers;
- }
-
- protected int getSubclassPropertyTableNumber(int i) {
- return subclassPropertyTableNumberClosure[i];
- }
-
- public int getTableSpan() {
- return tableSpan;
- }
-
- public boolean isMultiTable() {
- return true;
- }
-
- protected int[] getSubclassColumnTableNumberClosure() {
- return subclassColumnTableNumberClosure;
- }
-
- protected int[] getSubclassFormulaTableNumberClosure() {
- return subclassFormulaTableNumberClosure;
- }
-
- protected int[] getPropertyTableNumbers() {
- return naturalOrderPropertyTableNumbers;
- }
-
- protected String[] getSubclassTableKeyColumns(int j) {
- return subclassTableKeyColumnClosure[j];
- }
-
- public String getSubclassTableName(int j) {
- return subclassTableNameClosure[j];
- }
-
- public int getSubclassTableSpan() {
- return subclassTableNameClosure.length;
- }
-
- protected boolean isSubclassTableLazy(int j) {
- return subclassTableIsLazyClosure[j];
- }
-
-
- protected boolean isClassOrSuperclassTable(int j) {
- return isClassOrSuperclassTable[j];
- }
-
- public String getPropertyTableName(String propertyName) {
- Integer index = getEntityMetamodel().getPropertyIndexOrNull(propertyName);
- if ( index == null ) {
- return null;
- }
- return tableNames[ propertyTableNumbers[ index.intValue() ] ];
- }
-
- public String[] getConstraintOrderedTableNameClosure() {
- return constraintOrderedTableNames;
- }
-
- public String[][] getContraintOrderedTableKeyColumnClosure() {
- return constraintOrderedKeyColumnNames;
- }
-
- public String getRootTableName() {
- return naturalOrderTableNames[0];
- }
-
- public String getRootTableAlias(String drivingAlias) {
- return generateTableAlias( drivingAlias, getTableId( getRootTableName(), tableNames ) );
- }
-
- public Declarer getSubclassPropertyDeclarer(String propertyPath) {
- if ( "class".equals( propertyPath ) ) {
- // special case where we need to force incloude all subclass joins
- return Declarer.SUBCLASS;
- }
- return super.getSubclassPropertyDeclarer( propertyPath );
- }
-}
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.persister.entity;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.hibernate.AssertionFailure;
+import org.hibernate.Hibernate;
+import org.hibernate.HibernateException;
+import org.hibernate.MappingException;
+import org.hibernate.QueryException;
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
+import org.hibernate.engine.Mapping;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.engine.Versioning;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.KeyValue;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Selectable;
+import org.hibernate.mapping.Subclass;
+import org.hibernate.mapping.Table;
+import org.hibernate.sql.CaseFragment;
+import org.hibernate.sql.SelectFragment;
+import org.hibernate.type.AbstractType;
+import org.hibernate.type.Type;
+import org.hibernate.util.ArrayHelper;
+
+/**
+ * An <tt>EntityPersister</tt> implementing the normalized "table-per-subclass"
+ * mapping strategy
+ *
+ * @author Gavin King
+ */
+public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
+
+ // the class hierarchy structure
+ private final int tableSpan;
+ private final String[] tableNames;
+ private final String[] naturalOrderTableNames;
+ private final String[][] tableKeyColumns;
+ private final String[][] tableKeyColumnReaders;
+ private final String[][] tableKeyColumnReaderTemplates;
+ private final String[][] naturalOrderTableKeyColumns;
+ private final String[][] naturalOrderTableKeyColumnReaders;
+ private final String[][] naturalOrderTableKeyColumnReaderTemplates;
+ private final boolean[] naturalOrderCascadeDeleteEnabled;
+
+ private final String[] spaces;
+
+ private final String[] subclassClosure;
+
+ private final String[] subclassTableNameClosure;
+ private final String[][] subclassTableKeyColumnClosure;
+ private final boolean[] isClassOrSuperclassTable;
+
+ // properties of this class, including inherited properties
+ private final int[] naturalOrderPropertyTableNumbers;
+ private final int[] propertyTableNumbers;
+
+ // the closure of all properties in the entire hierarchy including
+ // subclasses and superclasses of this class
+ private final int[] subclassPropertyTableNumberClosure;
+
+ // the closure of all columns used by the entire hierarchy including
+ // subclasses and superclasses of this class
+ private final int[] subclassColumnTableNumberClosure;
+ private final int[] subclassFormulaTableNumberClosure;
+
+ // subclass discrimination works by assigning particular
+ // values to certain combinations of null primary key
+ // values in the outer join using an SQL CASE
+ private final Map subclassesByDiscriminatorValue = new HashMap();
+ private final String[] discriminatorValues;
+ private final String[] notNullColumnNames;
+ private final int[] notNullColumnTableNumbers;
+
+ private final String[] constraintOrderedTableNames;
+ private final String[][] constraintOrderedKeyColumnNames;
+
+ private final String discriminatorSQLString;
+
+ //INITIALIZATION:
+
+ public JoinedSubclassEntityPersister(
+ final PersistentClass persistentClass,
+ final EntityRegionAccessStrategy cacheAccessStrategy,
+ final SessionFactoryImplementor factory,
+ final Mapping mapping) throws HibernateException {
+
+ super( persistentClass, cacheAccessStrategy, factory );
+
+ // DISCRIMINATOR
+
+ final Object discriminatorValue;
+ if ( persistentClass.isPolymorphic() ) {
+ try {
+ discriminatorValue = new Integer( persistentClass.getSubclassId() );
+ discriminatorSQLString = discriminatorValue.toString();
+ }
+ catch (Exception e) {
+ throw new MappingException("Could not format discriminator value to SQL string", e );
+ }
+ }
+ else {
+ discriminatorValue = null;
+ discriminatorSQLString = null;
+ }
+
+ if ( optimisticLockMode() > Versioning.OPTIMISTIC_LOCK_VERSION ) {
+ throw new MappingException( "optimistic-lock=all|dirty not supported for joined-subclass mappings [" + getEntityName() + "]" );
+ }
+
+ //MULTITABLES
+
+ final int idColumnSpan = getIdentifierColumnSpan();
+
+ ArrayList tables = new ArrayList();
+ ArrayList keyColumns = new ArrayList();
+ ArrayList keyColumnReaders = new ArrayList();
+ ArrayList keyColumnReaderTemplates = new ArrayList();
+ ArrayList cascadeDeletes = new ArrayList();
+ Iterator titer = persistentClass.getTableClosureIterator();
+ Iterator kiter = persistentClass.getKeyClosureIterator();
+ while ( titer.hasNext() ) {
+ Table tab = (Table) titer.next();
+ KeyValue key = (KeyValue) kiter.next();
+ String tabname = tab.getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ );
+ tables.add(tabname);
+ String[] keyCols = new String[idColumnSpan];
+ String[] keyColReaders = new String[idColumnSpan];
+ String[] keyColReaderTemplates = new String[idColumnSpan];
+ Iterator citer = key.getColumnIterator();
+ for ( int k=0; k<idColumnSpan; k++ ) {
+ Column column = (Column) citer.next();
+ keyCols[k] = column.getQuotedName( factory.getDialect() );
+ keyColReaders[k] = column.getReadExpr( factory.getDialect() );
+ keyColReaderTemplates[k] = column.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
+ }
+ keyColumns.add(keyCols);
+ keyColumnReaders.add(keyColReaders);
+ keyColumnReaderTemplates.add(keyColReaderTemplates);
+ cascadeDeletes.add( new Boolean( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() ) );
+ }
+ naturalOrderTableNames = ArrayHelper.toStringArray(tables);
+ naturalOrderTableKeyColumns = ArrayHelper.to2DStringArray(keyColumns);
+ naturalOrderTableKeyColumnReaders = ArrayHelper.to2DStringArray(keyColumnReaders);
+ naturalOrderTableKeyColumnReaderTemplates = ArrayHelper.to2DStringArray(keyColumnReaderTemplates);
+ naturalOrderCascadeDeleteEnabled = ArrayHelper.toBooleanArray(cascadeDeletes);
+
+ ArrayList subtables = new ArrayList();
+ ArrayList isConcretes = new ArrayList();
+ keyColumns = new ArrayList();
+ titer = persistentClass.getSubclassTableClosureIterator();
+ while ( titer.hasNext() ) {
+ Table tab = (Table) titer.next();
+ isConcretes.add( new Boolean( persistentClass.isClassOrSuperclassTable(tab) ) );
+ String tabname = tab.getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ );
+ subtables.add(tabname);
+ String[] key = new String[idColumnSpan];
+ Iterator citer = tab.getPrimaryKey().getColumnIterator();
+ for ( int k=0; k<idColumnSpan; k++ ) {
+ key[k] = ( (Column) citer.next() ).getQuotedName( factory.getDialect() );
+ }
+ keyColumns.add(key);
+ }
+ subclassTableNameClosure = ArrayHelper.toStringArray(subtables);
+ subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray(keyColumns);
+ isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
+
+ constraintOrderedTableNames = new String[subclassTableNameClosure.length];
+ constraintOrderedKeyColumnNames = new String[subclassTableNameClosure.length][];
+ int currentPosition = 0;
+ for ( int i = subclassTableNameClosure.length - 1; i >= 0 ; i--, currentPosition++ ) {
+ constraintOrderedTableNames[currentPosition] = subclassTableNameClosure[i];
+ constraintOrderedKeyColumnNames[currentPosition] = subclassTableKeyColumnClosure[i];
+ }
+
+ tableSpan = naturalOrderTableNames.length;
+ tableNames = reverse(naturalOrderTableNames);
+ tableKeyColumns = reverse(naturalOrderTableKeyColumns);
+ tableKeyColumnReaders = reverse(naturalOrderTableKeyColumnReaders);
+ tableKeyColumnReaderTemplates = reverse(naturalOrderTableKeyColumnReaderTemplates);
+ reverse(subclassTableNameClosure, tableSpan);
+ reverse(subclassTableKeyColumnClosure, tableSpan);
+
+ spaces = ArrayHelper.join(
+ tableNames,
+ ArrayHelper.toStringArray( persistentClass.getSynchronizedTables() )
+ );
+
+ // Custom sql
+ customSQLInsert = new String[tableSpan];
+ customSQLUpdate = new String[tableSpan];
+ customSQLDelete = new String[tableSpan];
+ insertCallable = new boolean[tableSpan];
+ updateCallable = new boolean[tableSpan];
+ deleteCallable = new boolean[tableSpan];
+ insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
+ updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
+ deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
+
+ PersistentClass pc = persistentClass;
+ int jk = tableSpan-1;
+ while (pc!=null) {
+ customSQLInsert[jk] = pc.getCustomSQLInsert();
+ insertCallable[jk] = customSQLInsert[jk] != null && pc.isCustomInsertCallable();
+ insertResultCheckStyles[jk] = pc.getCustomSQLInsertCheckStyle() == null
+ ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[jk], insertCallable[jk] )
+ : pc.getCustomSQLInsertCheckStyle();
+ customSQLUpdate[jk] = pc.getCustomSQLUpdate();
+ updateCallable[jk] = customSQLUpdate[jk] != null && pc.isCustomUpdateCallable();
+ updateResultCheckStyles[jk] = pc.getCustomSQLUpdateCheckStyle() == null
+ ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[jk], updateCallable[jk] )
+ : pc.getCustomSQLUpdateCheckStyle();
+ customSQLDelete[jk] = pc.getCustomSQLDelete();
+ deleteCallable[jk] = customSQLDelete[jk] != null && pc.isCustomDeleteCallable();
+ deleteResultCheckStyles[jk] = pc.getCustomSQLDeleteCheckStyle() == null
+ ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[jk], deleteCallable[jk] )
+ : pc.getCustomSQLDeleteCheckStyle();
+ jk--;
+ pc = pc.getSuperclass();
+ }
+ if ( jk != -1 ) {
+ throw new AssertionFailure( "Tablespan does not match height of joined-subclass hiearchy." );
+ }
+
+ // PROPERTIES
+
+ int hydrateSpan = getPropertySpan();
+ naturalOrderPropertyTableNumbers = new int[hydrateSpan];
+ propertyTableNumbers = new int[hydrateSpan];
+ Iterator iter = persistentClass.getPropertyClosureIterator();
+ int i=0;
+ while( iter.hasNext() ) {
+ Property prop = (Property) iter.next();
+ String tabname = prop.getValue().getTable().getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ );
+ propertyTableNumbers[i] = getTableId(tabname, tableNames);
+ naturalOrderPropertyTableNumbers[i] = getTableId(tabname, naturalOrderTableNames);
+ i++;
+ }
+
+ // subclass closure properties
+
+ //TODO: code duplication with SingleTableEntityPersister
+
+ ArrayList columnTableNumbers = new ArrayList();
+ ArrayList formulaTableNumbers = new ArrayList();
+ ArrayList propTableNumbers = new ArrayList();
+
+ iter = persistentClass.getSubclassPropertyClosureIterator();
+ while ( iter.hasNext() ) {
+ Property prop = (Property) iter.next();
+ Table tab = prop.getValue().getTable();
+ String tabname = tab.getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ );
+ Integer tabnum = new Integer( getTableId(tabname, subclassTableNameClosure) );
+ propTableNumbers.add(tabnum);
+
+ Iterator citer = prop.getColumnIterator();
+ while ( citer.hasNext() ) {
+ Selectable thing = (Selectable) citer.next();
+ if ( thing.isFormula() ) {
+ formulaTableNumbers.add(tabnum);
+ }
+ else {
+ columnTableNumbers.add(tabnum);
+ }
+ }
+
+ }
+
+ subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnTableNumbers);
+ subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propTableNumbers);
+ subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaTableNumbers);
+
+ // SUBCLASSES
+
+ int subclassSpan = persistentClass.getSubclassSpan() + 1;
+ subclassClosure = new String[subclassSpan];
+ subclassClosure[subclassSpan-1] = getEntityName();
+ if ( persistentClass.isPolymorphic() ) {
+ subclassesByDiscriminatorValue.put( discriminatorValue, getEntityName() );
+ discriminatorValues = new String[subclassSpan];
+ discriminatorValues[subclassSpan-1] = discriminatorSQLString;
+ notNullColumnTableNumbers = new int[subclassSpan];
+ final int id = getTableId(
+ persistentClass.getTable().getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ ),
+ subclassTableNameClosure
+ );
+ notNullColumnTableNumbers[subclassSpan-1] = id;
+ notNullColumnNames = new String[subclassSpan];
+ notNullColumnNames[subclassSpan-1] = subclassTableKeyColumnClosure[id][0]; //( (Column) model.getTable().getPrimaryKey().getColumnIterator().next() ).getName();
+ }
+ else {
+ discriminatorValues = null;
+ notNullColumnTableNumbers = null;
+ notNullColumnNames = null;
+ }
+
+ iter = persistentClass.getSubclassIterator();
+ int k=0;
+ while ( iter.hasNext() ) {
+ Subclass sc = (Subclass) iter.next();
+ subclassClosure[k] = sc.getEntityName();
+ try {
+ if ( persistentClass.isPolymorphic() ) {
+ // we now use subclass ids that are consistent across all
+ // persisters for a class hierarchy, so that the use of
+ // "foo.class = Bar" works in HQL
+ Integer subclassId = new Integer( sc.getSubclassId() );//new Integer(k+1);
+ subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() );
+ discriminatorValues[k] = subclassId.toString();
+ int id = getTableId(
+ sc.getTable().getQualifiedName(
+ factory.getDialect(),
+ factory.getSettings().getDefaultCatalogName(),
+ factory.getSettings().getDefaultSchemaName()
+ ),
+ subclassTableNameClosure
+ );
+ notNullColumnTableNumbers[k] = id;
+ notNullColumnNames[k] = subclassTableKeyColumnClosure[id][0]; //( (Column) sc.getTable().getPrimaryKey().getColumnIterator().next() ).getName();
+ }
+ }
+ catch (Exception e) {
+ throw new MappingException("Error parsing discriminator value", e );
+ }
+ k++;
+ }
+
+ initLockers();
+
+ initSubclassPropertyAliasesMap(persistentClass);
+
+ postConstruct(mapping);
+
+ }
+
+ /*public void postInstantiate() throws MappingException {
+ super.postInstantiate();
+ //TODO: other lock modes?
+ loader = createEntityLoader(LockMode.NONE, CollectionHelper.EMPTY_MAP);
+ }*/
+
+ public String getSubclassPropertyTableName(int i) {
+ return subclassTableNameClosure[ subclassPropertyTableNumberClosure[i] ];
+ }
+
+ public Type getDiscriminatorType() {
+ return Hibernate.INTEGER;
+ }
+
+ public String getDiscriminatorSQLValue() {
+ return discriminatorSQLString;
+ }
+
+
+ public String getSubclassForDiscriminatorValue(Object value) {
+ return (String) subclassesByDiscriminatorValue.get(value);
+ }
+
+ public Serializable[] getPropertySpaces() {
+ return spaces; // don't need subclass tables, because they can't appear in conditions
+ }
+
+
+ protected String getTableName(int j) {
+ return naturalOrderTableNames[j];
+ }
+
+ protected String[] getKeyColumns(int j) {
+ return naturalOrderTableKeyColumns[j];
+ }
+
+ protected boolean isTableCascadeDeleteEnabled(int j) {
+ return naturalOrderCascadeDeleteEnabled[j];
+ }
+
+ protected boolean isPropertyOfTable(int property, int j) {
+ return naturalOrderPropertyTableNumbers[property]==j;
+ }
+
+ /**
+ * Load an instance using either the <tt>forUpdateLoader</tt> or the outer joining <tt>loader</tt>,
+ * depending upon the value of the <tt>lock</tt> parameter
+ */
+ /*public Object load(Serializable id, Object optionalObject, LockMode lockMode, SessionImplementor session)
+ throws HibernateException {
+
+ if ( log.isTraceEnabled() ) log.trace( "Materializing entity: " + MessageHelper.infoString(this, id) );
+
+ final UniqueEntityLoader loader = hasQueryLoader() ?
+ getQueryLoader() :
+ this.loader;
+ try {
+
+ final Object result = loader.load(id, optionalObject, session);
+
+ if (result!=null) lock(id, getVersion(result), result, lockMode, session);
+
+ return result;
+
+ }
+ catch (SQLException sqle) {
+ throw new JDBCException( "could not load by id: " + MessageHelper.infoString(this, id), sqle );
+ }
+ }*/
+
+ private static final void reverse(Object[] objects, int len) {
+ Object[] temp = new Object[len];
+ for (int i=0; i<len; i++) {
+ temp[i] = objects[len-i-1];
+ }
+ for (int i=0; i<len; i++) {
+ objects[i] = temp[i];
+ }
+ }
+
+ private static final String[] reverse(String[] objects) {
+ int len = objects.length;
+ String[] temp = new String[len];
+ for (int i=0; i<len; i++) {
+ temp[i] = objects[len-i-1];
+ }
+ return temp;
+ }
+
+ private static final String[][] reverse(String[][] objects) {
+ int len = objects.length;
+ String[][] temp = new String[len][];
+ for (int i=0; i<len; i++) {
+ temp[i] = objects[len-i-1];
+ }
+ return temp;
+ }
+
+ public String fromTableFragment(String alias) {
+ return getTableName() + ' ' + alias;
+ }
+
+ public String getTableName() {
+ return tableNames[0];
+ }
+
+ private static int getTableId(String tableName, String[] tables) {
+ for ( int j=0; j<tables.length; j++ ) {
+ if ( tableName.equals( tables[j] ) ) {
+ return j;
+ }
+ }
+ throw new AssertionFailure("Table " + tableName + " not found");
+ }
+
+ public void addDiscriminatorToSelect(SelectFragment select, String name, String suffix) {
+ if ( hasSubclasses() ) {
+ select.setExtraSelectList( discriminatorFragment(name), getDiscriminatorAlias() );
+ }
+ }
+
+ private CaseFragment discriminatorFragment(String alias) {
+ CaseFragment cases = getFactory().getDialect().createCaseFragment();
+
+ for ( int i=0; i<discriminatorValues.length; i++ ) {
+ cases.addWhenColumnNotNull(
+ generateTableAlias( alias, notNullColumnTableNumbers[i] ),
+ notNullColumnNames[i],
+ discriminatorValues[i]
+ );
+ }
+
+ return cases;
+ }
+
+ public String filterFragment(String alias) {
+ return hasWhere() ?
+ " and " + getSQLWhereString( generateFilterConditionAlias( alias ) ) :
+ "";
+ }
+
+ public String generateFilterConditionAlias(String rootAlias) {
+ return generateTableAlias( rootAlias, tableSpan-1 );
+ }
+
+ public String[] getIdentifierColumnNames() {
+ return tableKeyColumns[0];
+ }
+
+ public String[] getIdentifierColumnReaderTemplates() {
+ return tableKeyColumnReaderTemplates[0];
+ }
+
+ public String[] getIdentifierColumnReaders() {
+ return tableKeyColumnReaders[0];
+ }
+
+ public String[] toColumns(String alias, String propertyName) throws QueryException {
+
+ if ( ENTITY_CLASS.equals(propertyName) ) {
+ // This doesn't actually seem to work but it *might*
+ // work on some dbs. Also it doesn't work if there
+ // are multiple columns of results because it
+ // is not accounting for the suffix:
+ // return new String[] { getDiscriminatorColumnName() };
+
+ return new String[] { discriminatorFragment(alias).toFragmentString() };
+ }
+ else {
+ return super.toColumns(alias, propertyName);
+ }
+
+ }
+
+ protected int[] getPropertyTableNumbersInSelect() {
+ return propertyTableNumbers;
+ }
+
+ protected int getSubclassPropertyTableNumber(int i) {
+ return subclassPropertyTableNumberClosure[i];
+ }
+
+ public int getTableSpan() {
+ return tableSpan;
+ }
+
+ public boolean isMultiTable() {
+ return true;
+ }
+
+ protected int[] getSubclassColumnTableNumberClosure() {
+ return subclassColumnTableNumberClosure;
+ }
+
+ protected int[] getSubclassFormulaTableNumberClosure() {
+ return subclassFormulaTableNumberClosure;
+ }
+
+ protected int[] getPropertyTableNumbers() {
+ return naturalOrderPropertyTableNumbers;
+ }
+
+ protected String[] getSubclassTableKeyColumns(int j) {
+ return subclassTableKeyColumnClosure[j];
+ }
+
+ public String getSubclassTableName(int j) {
+ return subclassTableNameClosure[j];
+ }
+
+ public int getSubclassTableSpan() {
+ return subclassTableNameClosure.length;
+ }
+
+ protected boolean isClassOrSuperclassTable(int j) {
+ return isClassOrSuperclassTable[j];
+ }
+
+ public String getPropertyTableName(String propertyName) {
+ Integer index = getEntityMetamodel().getPropertyIndexOrNull(propertyName);
+ if ( index == null ) {
+ return null;
+ }
+ return tableNames[ propertyTableNumbers[ index.intValue() ] ];
+ }
+
+ public String[] getConstraintOrderedTableNameClosure() {
+ return constraintOrderedTableNames;
+ }
+
+ public String[][] getContraintOrderedTableKeyColumnClosure() {
+ return constraintOrderedKeyColumnNames;
+ }
+
+ public String getRootTableName() {
+ return naturalOrderTableNames[0];
+ }
+
+ public String getRootTableAlias(String drivingAlias) {
+ return generateTableAlias( drivingAlias, getTableId( getRootTableName(), tableNames ) );
+ }
+
+ public Declarer getSubclassPropertyDeclarer(String propertyPath) {
+ if ( "class".equals( propertyPath ) ) {
+ // special case where we need to force incloude all subclass joins
+ return Declarer.SUBCLASS;
+ }
+ return super.getSubclassPropertyDeclarer( propertyPath );
+ }
+}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
@@ -293,7 +293,6 @@ public class StatisticsImpl implements S
if (hql!=null) {
QueryStatisticsImpl qs = (QueryStatisticsImpl) getQueryStatistics(hql);
qs.executed(rows, time);
- log.info("HQL: {}, time: {}ms, rows: {}", new Object[]{hql, new Long(time), new Long(rows)});
}
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/tuple/Instantiator.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/tuple/Instantiator.java
@@ -56,7 +56,7 @@ public interface Instantiator extends Se
* or component which this Instantiator instantiates.
*
* @param object The object to be checked.
- * @return True is the object does represent an instance of the underlying
+ * @return True is the object does respresent an instance of the underlying
* entity/component.
*/
public boolean isInstance(Object object);
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
@@ -122,7 +122,7 @@ public class EntityMetamodel implements
private final boolean inherited;
private final boolean hasSubclasses;
private final Set subclassEntityNames = new HashSet();
- private final Map entityNameByInheritenceClassMap = new HashMap();
+ private final Map entityNameByInheritenceClassNameMap = new HashMap();
private final EntityEntityModeToTuplizerMapping tuplizerMapping;
@@ -312,11 +312,11 @@ public class EntityMetamodel implements
subclassEntityNames.add( name );
if ( persistentClass.hasPojoRepresentation() ) {
- entityNameByInheritenceClassMap.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
+ entityNameByInheritenceClassNameMap.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
iter = persistentClass.getSubclassIterator();
while ( iter.hasNext() ) {
final PersistentClass pc = ( PersistentClass ) iter.next();
- entityNameByInheritenceClassMap.put( pc.getMappedClass(), pc.getEntityName() );
+ entityNameByInheritenceClassNameMap.put( pc.getMappedClass(), pc.getEntityName() );
}
}
@@ -570,13 +570,13 @@ public class EntityMetamodel implements
}
/**
- * Return the entity-name mapped to the given class within our inheritance hierarchy, if any.
+ * Return the entity-name mapped to the given class within our inheritence hierarchy, if any.
*
* @param inheritenceClass The class for which to resolve the entity-name.
* @return The mapped entity-name, or null if no such mapping was found.
*/
public String findEntityNameByEntityClass(Class inheritenceClass) {
- return ( String ) entityNameByInheritenceClassMap.get( inheritenceClass );
+ return ( String ) entityNameByInheritenceClassNameMap.get( inheritenceClass.getName() );
}
public String toString() {
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java
@@ -1094,10 +1094,6 @@ public class StatefulPersistenceContext
public void afterLoad() {
loadCounter--;
}
-
- public boolean isLoadFinished() {
- return loadCounter == 0;
- }
/**
* Returns a string representation of the object.
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/LoadQueryInfluencers.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/LoadQueryInfluencers.java
@@ -111,14 +111,6 @@ public class LoadQueryInfluencers implem
return enabledFilters;
}
- /**
- * Returns an unmodifiable Set of enabled filter names.
- * @return an unmodifiable Set of enabled filter names.
- */
- public Set getEnabledFilterNames() {
- return java.util.Collections.unmodifiableSet( enabledFilters.keySet() );
- }
-
public Filter getEnabledFilter(String filterName) {
return ( Filter ) enabledFilters.get( filterName );
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/PersistenceContext.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/PersistenceContext.java
@@ -445,11 +445,6 @@ public interface PersistenceContext {
* Call this after finishing a two-phase load
*/
public void afterLoad();
-
- /**
- * Is in a two-phase load?
- */
- public boolean isLoadFinished();
/**
* Returns a string representation of the object.
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryScalarReturn.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryScalarReturn.java
@@ -32,8 +32,8 @@ import org.hibernate.type.Type;
* @author gloegl
*/
public class NativeSQLQueryScalarReturn implements NativeSQLQueryReturn {
- private final Type type;
- private final String columnAlias;
+ private Type type;
+ private String columnAlias;
private final int hashCode;
public NativeSQLQueryScalarReturn(String alias, Type type) {
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryCollectionReturn.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryCollectionReturn.java
@@ -38,8 +38,8 @@ import org.hibernate.LockMode;
* @author Steve Ebersole
*/
public class NativeSQLQueryCollectionReturn extends NativeSQLQueryNonScalarReturn {
- private final String ownerEntityName;
- private final String ownerProperty;
+ private String ownerEntityName;
+ private String ownerProperty;
private final int hashCode;
/**
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryJoinReturn.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryJoinReturn.java
@@ -35,8 +35,8 @@ import org.hibernate.LockMode;
* @author Steve Ebersole
*/
public class NativeSQLQueryJoinReturn extends NativeSQLQueryNonScalarReturn {
- private final String ownerAlias;
- private final String ownerProperty;
+ private String ownerAlias;
+ private String ownerProperty;
private final int hashCode;
/**
* Construct a return descriptor representing some form of fetch.
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryRootReturn.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryRootReturn.java
@@ -36,7 +36,7 @@ import org.hibernate.LockMode;
* @author Steve Ebersole
*/
public class NativeSQLQueryRootReturn extends NativeSQLQueryNonScalarReturn {
- private final String returnEntityName;
+ private String returnEntityName;
private final int hashCode;
/**
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
+ * distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,6 +20,7 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
+ *
*/
package org.hibernate.dialect;
@@ -31,11 +32,10 @@ import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.JDBCException;
+import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
-import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
@@ -43,55 +43,29 @@ import org.hibernate.dialect.lock.*;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
-import org.hibernate.util.ReflectHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * An SQL dialect compatible with HSQLDB (HyperSQL).
+ * An SQL dialect compatible with HSQLDB (Hypersonic SQL).
* <p/>
* Note this version supports HSQLDB version 1.8 and higher, only.
- * <p/>
- * Enhancements to version 3.5.0 GA to provide basic support for both HSQLDB 1.8.x and 2.0
- * Should work with Hibernate 3.2 and later
*
* @author Christoph Sturm
* @author Phillip Baird
- * @author Fred Toussi
*/
public class HSQLDialect extends Dialect {
-
private static final Logger log = LoggerFactory.getLogger( HSQLDialect.class );
- /**
- * version is 18 for 1.8 or 20 for 2.0
- */
- private int hsqldbVersion = 18;
-
-
public HSQLDialect() {
super();
-
- try {
- Class props = ReflectHelper.classForName( "org.hsqldb.persist.HsqlDatabaseProperties" );
- String versionString = (String) props.getDeclaredField( "THIS_VERSION" ).get( null );
-
- hsqldbVersion = Integer.parseInt( versionString.substring( 0, 1 ) ) * 10;
- hsqldbVersion += Integer.parseInt( versionString.substring( 2, 3 ) );
- }
- catch ( Throwable e ) {
- // must be a very old version
- }
-
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.BINARY, "binary" );
registerColumnType( Types.BIT, "bit" );
- registerColumnType( Types.CHAR, "char($l)" );
+ registerColumnType( Types.CHAR, "char(1)" );
registerColumnType( Types.DATE, "date" );
-
- registerColumnType( Types.DECIMAL, "decimal($p,$s)" );
+ registerColumnType( Types.DECIMAL, "decimal" );
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
@@ -103,23 +77,12 @@ public class HSQLDialect extends Dialect
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.VARCHAR, "varchar($l)" );
registerColumnType( Types.VARBINARY, "varbinary($l)" );
-
- if ( hsqldbVersion < 20 ) {
- registerColumnType( Types.NUMERIC, "numeric" );
- }
- else {
- registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
- }
-
+ registerColumnType( Types.NUMERIC, "numeric" );
//HSQL has no Blob/Clob support .... but just put these here for now!
- if ( hsqldbVersion < 20 ) {
- registerColumnType( Types.BLOB, "longvarbinary" );
- registerColumnType( Types.CLOB, "longvarchar" );
- }
- else {
- registerColumnType( Types.BLOB, "blob" );
- registerColumnType( Types.CLOB, "clob" );
- }
+ registerColumnType( Types.BLOB, "longvarbinary" );
+ registerColumnType( Types.CLOB, "longvarchar" );
+ registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
+ registerColumnType( Types.LONGVARCHAR, "longvarchar" );
registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
@@ -136,16 +99,13 @@ public class HSQLDialect extends Dialect
registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(24))" ) );
+
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
- registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
- registerFunction(
- "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false )
- );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false ) );
registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
@@ -156,7 +116,7 @@ public class HSQLDialect extends Dialect
registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
- registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
+ registerFunction( "quater", new StandardSQLFunction( "quater", Hibernate.INTEGER ) );
registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
@@ -213,7 +173,7 @@ public class HSQLDialect extends Dialect
}
public String getIdentityInsertString() {
- return hsqldbVersion < 20 ? "null" : "default";
+ return "null";
}
public boolean supportsLockTimeouts() {
@@ -233,25 +193,14 @@ public class HSQLDialect extends Dialect
}
public String getLimitString(String sql, boolean hasOffset) {
- if ( hsqldbVersion < 20 ) {
- return new StringBuffer( sql.length() + 10 )
- .append( sql )
- .insert(
- sql.toLowerCase().indexOf( "select" ) + 6,
- hasOffset ? " limit ? ?" : " top ?"
- )
- .toString();
- }
- else {
- return new StringBuffer( sql.length() + 20 )
- .append( sql )
- .append( hasOffset ? " offset ? limit ?" : " limit ?" )
- .toString();
- }
+ return new StringBuffer( sql.length() + 10 )
+ .append( sql )
+ .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit ? ?" : " top ?" )
+ .toString();
}
public boolean bindLimitParametersFirst() {
- return hsqldbVersion < 20;
+ return true;
}
public boolean supportsIfExistsAfterTableName() {
@@ -259,7 +208,7 @@ public class HSQLDialect extends Dialect
}
public boolean supportsColumnCheck() {
- return hsqldbVersion >= 20;
+ return false;
}
public boolean supportsSequences() {
@@ -292,10 +241,10 @@ public class HSQLDialect extends Dialect
}
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
- return hsqldbVersion < 20 ? EXTRACTER_18 : EXTRACTER_20;
+ return EXTRACTER;
}
- private static ViolatedConstraintNameExtracter EXTRACTER_18 = new TemplatedViolatedConstraintNameExtracter() {
+ private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
/**
* Extract the name of the violated constraint from the given SQLException.
@@ -325,260 +274,40 @@ public class HSQLDialect extends Dialect
}
else if ( errorCode == -177 ) {
constraintName = extractUsingTemplate(
- "Integrity constraint violation - no parent ", " table:",
- sqle.getMessage()
+ "Integrity constraint violation - no parent ", " table:", sqle.getMessage()
);
}
- return constraintName;
- }
- };
-
- /**
- * HSQLDB 2.0 messages have changed
- * messages may be localized - therefore use the common, non-locale element " table: "
- */
- private static ViolatedConstraintNameExtracter EXTRACTER_20 = new TemplatedViolatedConstraintNameExtracter() {
-
- public String extractConstraintName(SQLException sqle) {
- String constraintName = null;
-
- int errorCode = JDBCExceptionHelper.extractErrorCode( sqle );
-
- if ( errorCode == -8 ) {
- constraintName = extractUsingTemplate(
- "; ", " table: ", sqle.getMessage()
- );
- }
- else if ( errorCode == -9 ) {
- constraintName = extractUsingTemplate(
- "; ", " table: ", sqle.getMessage()
- );
- }
- else if ( errorCode == -104 ) {
- constraintName = extractUsingTemplate(
- "; ", " table: ", sqle.getMessage()
- );
- }
- else if ( errorCode == -177 ) {
- constraintName = extractUsingTemplate(
- "; ", " table: ", sqle.getMessage()
- );
- }
return constraintName;
}
- };
-
- public String getSelectClauseNullString(int sqlType) {
- String literal;
- switch ( sqlType ) {
- case Types.VARCHAR:
- case Types.CHAR:
- literal = "cast(null as varchar(100))";
- break;
- case Types.DATE:
- literal = "cast(null as date)";
- break;
- case Types.TIMESTAMP:
- literal = "cast(null as timestamp)";
- break;
- case Types.TIME:
- literal = "cast(null as time)";
- break;
- default:
- literal = "cast(null as int)";
- }
- return literal;
- }
-
- // temporary table support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Hibernate uses this information for temporary tables that it uses for its own operations
- // therefore the appropriate strategy is taken with different versions of HSQLDB
-
- // All versions of HSQLDB support GLOBAL TEMPORARY tables where the table
- // definition is shared by all users but data is private to the session
- // HSQLDB 2.0 also supports session-based LOCAL TEMPORARY tables where
- // the definition and data is private to the session and table declaration
- // can happen in the middle of a transaction
+ };
/**
- * Does this dialect support temporary tables?
- *
- * @return True if temp tables are supported; false otherwise.
+ * HSQL does not really support temp tables; just take advantage of the
+ * fact that it is a single user db...
*/
public boolean supportsTemporaryTables() {
return true;
}
- /**
- * With HSQLDB 2.0, the table name is qualified with MODULE to assist the drop
- * statement (in-case there is a global name beginning with HT_)
- *
- * @param baseTableName The table name from which to base the temp table name.
- *
- * @return The generated temp table name.
- */
- public String generateTemporaryTableName(String baseTableName) {
- if ( hsqldbVersion < 20 ) {
- return "HT_" + baseTableName;
- }
- else {
- return "MODULE.HT_" + baseTableName;
- }
- }
-
- /**
- * Command used to create a temporary table.
- *
- * @return The command used to create a temporary table.
- */
- public String getCreateTemporaryTableString() {
- if ( hsqldbVersion < 20 ) {
- return "create global temporary table";
- }
- else {
- return "declare local temporary table";
- }
- }
-
- /**
- * No fragment is needed if data is not needed beyond commit, otherwise
- * should add "on commit preserve rows"
- *
- * @return Any required postfix.
- */
- public String getCreateTemporaryTablePostfix() {
- return "";
- }
-
- /**
- * Command used to drop a temporary table.
- *
- * @return The command used to drop a temporary table.
- */
- public String getDropTemporaryTableString() {
- return "drop table";
- }
-
- /**
- * Different behaviour for GLOBAL TEMPORARY (1.8) and LOCAL TEMPORARY (2.0)
- * <p/>
- * Possible return values and their meanings:<ul>
- * <li>{@link Boolean#TRUE} - Unequivocally, perform the temporary table DDL
- * in isolation.</li>
- * <li>{@link Boolean#FALSE} - Unequivocally, do <b>not</b> perform the
- * temporary table DDL in isolation.</li>
- * <li><i>null</i> - defer to the JDBC driver response in regards to
- * {@link java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()}</li>
- * </ul>
- *
- * @return see the result matrix above.
- */
- public Boolean performTemporaryTableDDLInIsolation() {
- if ( hsqldbVersion < 20 ) {
- return Boolean.TRUE;
- }
- else {
- return Boolean.FALSE;
- }
- }
-
- /**
- * Do we need to drop the temporary table after use?
- *
- * todo - clarify usage by Hibernate
- * Version 1.8 GLOBAL TEMPORARY table definitions persist beyond the end
- * of the session (data is cleared). If there are not too many such tables,
- * perhaps we can avoid dropping them and reuse the table next time?
- *
- * @return True if the table should be dropped.
- */
- public boolean dropTemporaryTableAfterUse() {
- return true;
- }
-
- // current timestamp support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- /**
- * HSQLDB 1.8.x requires CALL CURRENT_TIMESTAMP but this should not
- * be treated as a callable statement. It is equivalent to
- * "select current_timestamp from dual" in some databases.
- * HSQLDB 2.0 also supports VALUES CURRENT_TIMESTAMP
- *
- * @return True if the current timestamp can be retrieved; false otherwise.
- */
public boolean supportsCurrentTimestampSelection() {
- return true;
- }
-
- /**
- * Should the value returned by {@link #getCurrentTimestampSelectString}
- * be treated as callable. Typically this indicates that JDBC escape
- * syntax is being used...
- *
- * @return True if the {@link #getCurrentTimestampSelectString} return
- * is callable; false otherwise.
- */
- public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
- /**
- * Retrieve the command used to retrieve the current timestamp from the
- * database.
- *
- * @return The command.
- */
- public String getCurrentTimestampSelectString() {
- return "call current_timestamp";
- }
-
- /**
- * The name of the database-specific SQL function for retrieving the
- * current timestamp.
- *
- * @return The function name.
- */
- public String getCurrentTimestampSQLFunctionName() {
- // the standard SQL function name is current_timestamp...
- return "current_timestamp";
- }
-
- /**
- * For HSQLDB 2.0, this is a copy of the base class implementation.
- * For HSQLDB 1.8, only READ_UNCOMMITTED is supported.
- *
- * @param lockable The persister for the entity to be locked.
- * @param lockMode The type of lock to be acquired.
- *
- * @return The appropriate locking strategy.
- *
- * @since 3.2
- */
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
- if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
- return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
- }
- else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
- return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
- }
- else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
- return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
- }
- else if ( lockMode == LockMode.OPTIMISTIC ) {
- return new OptimisticLockingStrategy( lockable, lockMode );
+ // HSQLDB only supports READ_UNCOMMITTED transaction isolation
+ if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
+ return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
}
- else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
- return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
+ else if ( lockMode==LockMode.OPTIMISTIC) {
+ return new OptimisticLockingStrategy( lockable, lockMode);
}
-
- if ( hsqldbVersion < 20 ) {
- return new ReadUncommittedLockingStrategy( lockable, lockMode );
- }
- else {
- return new SelectLockingStrategy( lockable, lockMode );
+ else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
+ return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
}
+ return new ReadUncommittedLockingStrategy( lockable, lockMode );
+
}
public static class ReadUncommittedLockingStrategy extends SelectLockingStrategy {
@@ -595,9 +324,6 @@ public class HSQLDialect extends Dialect
}
}
- public boolean supportsCommentOn() {
- return true;
- }
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -605,51 +331,7 @@ public class HSQLDialect extends Dialect
return false;
}
- /**
- * todo - needs usage clarification
- *
- * If the SELECT statement is always part of a UNION, then the type of
- * parameter is resolved by v. 2.0, but not v. 1.8 (assuming the other
- * SELECT in the UNION has a column reference in the same position and
- * can be type-resolved).
- *
- * On the other hand if the SELECT statement is isolated, all versions of
- * HSQLDB require casting for "select ? from .." to work.
- *
- * @return True if select clause parameter must be cast()ed
- *
- * @since 3.2
- */
- public boolean requiresCastingOfParametersInSelectClause() {
- return true;
- }
-
- /**
- * For the underlying database, is READ_COMMITTED isolation implemented by
- * forcing readers to wait for write locks to be released?
- *
- * @return True if writers block readers to achieve READ_COMMITTED; false otherwise.
- */
- public boolean doesReadCommittedCauseWritersToBlockReaders() {
- return hsqldbVersion >= 20;
- }
-
- /**
- * For the underlying database, is REPEATABLE_READ isolation implemented by
- * forcing writers to wait for read locks to be released?
- *
- * @return True if readers block writers to achieve REPEATABLE_READ; false otherwise.
- */
- public boolean doesRepeatableReadCauseReadersToBlockWriters() {
- return hsqldbVersion >= 20;
- }
-
-
public boolean supportsLobValueChangePropogation() {
return false;
}
-
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
@@ -164,8 +164,4 @@ public class SQLServerDialect extends Ab
public boolean doesRepeatableReadCauseReadersToBlockWriters() {
return false; // here assume SQLServer2005 using snapshot isolation, which does not have this problem
}
-
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/H2Dialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/H2Dialect.java
@@ -309,8 +309,4 @@ public class H2Dialect extends Dialect {
public boolean supportsLobValueChangePropogation() {
return false;
}
-
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java
@@ -131,12 +131,8 @@ public class Oracle9iDialect extends Ora
* HHH-4907, I don't know if oracle 8 supports this syntax, so I'd think it is better add this
* method here. Reopen this issue if you found/know 8 supports it.
*/
- public boolean supportsRowValueConstructorSyntaxInInList() {
- return true;
- }
-
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
+ public boolean supportsRowValueConstructorSyntaxInInList() {
+ return true;
+ }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
@@ -290,10 +290,6 @@ public class PostgreSQLDialect extends D
return "select now()";
}
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
-
public String toBooleanValueString(boolean bool) {
return bool ? "true" : "false";
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/Ingres10Dialect.java
@@ -1,7 +1,6 @@
package org.hibernate.dialect;
import java.sql.Types;
-import java.util.Properties;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
@@ -9,10 +8,9 @@ import org.hibernate.dialect.function.No
/**
* A SQL dialect for Ingres 10 and later versions.
- * <p/>
+ *
* Changes:
* <ul>
- * <li>Add native BOOLEAN type support</li>
* </ul>
*
* @author Raymond Fan
@@ -20,39 +18,5 @@ import org.hibernate.dialect.function.No
public class Ingres10Dialect extends Ingres9Dialect {
public Ingres10Dialect() {
super();
- registerBooleanSupport();
- }
-
- // Boolean column type support
-
- /**
- * The SQL literal value to which this database maps boolean values.
- *
- * @param bool The boolean value
- * @return The appropriate SQL literal.
- */
- public String toBooleanValueString(boolean bool) {
- return bool ? "true" : "false";
- }
-
- protected void registerBooleanSupport() {
- // Column type
-
- // Boolean type (mapping/BooleanType) mapping maps SQL BIT to Java
- // Boolean. In order to create a boolean column, BIT needs to be mapped
- // to boolean as well, similar to H2Dialect.
- registerColumnType( Types.BIT, "boolean" );
- registerColumnType( Types.BOOLEAN, "boolean" );
-
- // Functions
-
- // true, false and unknown are now valid values
- // Remove the query substitutions previously added in IngresDialect.
- Properties properties = getDefaultProperties();
- String querySubst = properties.getProperty(Environment.QUERY_SUBSTITUTIONS);
- if (querySubst != null) {
- String newQuerySubst = querySubst.replace("true=1,false=0","");
- properties.setProperty(Environment.QUERY_SUBSTITUTIONS, newQuerySubst);
- }
}
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/Dialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/Dialect.java
@@ -1999,23 +1999,4 @@ public abstract class Dialect {
public boolean supportsBindAsCallableArgument() {
return true;
}
-
- /**
- * Does this dialect support `count(a,b)`?
- *
- * @return True if the database supports counting tuples; false otherwise.
- */
- public boolean supportsTupleCounts() {
- return false;
- }
-
- /**
- * Does this dialect support `count(distinct a,b)`?
- *
- * @return True if the database supports counting disintct tuples; false otherwise.
- */
- public boolean supportsTupleDistinctCounts() {
- // oddly most database in fact seem to, so true is the default.
- return true;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
@@ -432,8 +432,4 @@ public class DB2Dialect extends Dialect
public boolean doesReadCommittedCauseWritersToBlockReaders() {
return true;
}
-
- public boolean supportsTupleDistinctCounts() {
- return false;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/loader/custom/CustomLoader.java
@@ -328,7 +328,7 @@ public class CustomLoader extends Loader
}
static private HolderInstantiator getHolderInstantiator(ResultTransformer resultTransformer, String[] queryReturnAliases) {
- if ( resultTransformer == null ) {
+ if ( resultTransformer != null ) {
return HolderInstantiator.NOOP_INSTANTIATOR;
}
else {
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java
@@ -36,17 +36,14 @@ import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.LazyInitializationException;
import org.hibernate.engine.CollectionEntry;
-import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.ForeignKeys;
import org.hibernate.engine.SessionImplementor;
-import org.hibernate.engine.Status;
import org.hibernate.engine.TypedValue;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.type.Type;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.EmptyIterator;
-import org.hibernate.util.IdentitySet;
import org.hibernate.util.MarkerObject;
/**
@@ -908,29 +905,20 @@ public abstract class AbstractPersistent
// collect EntityIdentifier(s) of the *current* elements - add them into a HashSet for fast access
java.util.Set currentIds = new HashSet();
- java.util.Set currentSaving = new IdentitySet();
for ( Iterator it=currentElements.iterator(); it.hasNext(); ) {
Object current = it.next();
if ( current!=null && ForeignKeys.isNotTransient(entityName, current, null, session) ) {
- EntityEntry ee = session.getPersistenceContext().getEntry( current );
- if ( ee != null && ee.getStatus() == Status.SAVING ) {
- currentSaving.add( current );
- }
- else {
- Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, current, session);
- currentIds.add( new TypedValue( idType, currentId, session.getEntityMode() ) );
- }
+ Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, current, session);
+ currentIds.add( new TypedValue( idType, currentId, session.getEntityMode() ) );
}
}
// iterate over the *old* list
for ( Iterator it=oldElements.iterator(); it.hasNext(); ) {
Object old = it.next();
- if ( ! currentSaving.contains( old ) ) {
- Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);
- if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {
- res.add(old);
- }
+ Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);
+ if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {
+ res.add(old);
}
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/impl/SessionImpl.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/impl/SessionImpl.java
@@ -2141,14 +2141,9 @@ public final class SessionImpl extends A
childSessionsByEntityMode = ( Map ) ois.readObject();
- // LoadQueryInfluencers.getEnabledFilters() tries to validate each enabled
- // filter, which will fail when called before FilterImpl.afterDeserialize( factory );
- // Instead lookup the filter by name and then call FilterImpl.afterDeserialize( factory ).
- Iterator iter = loadQueryInfluencers.getEnabledFilterNames().iterator();
+ Iterator iter = loadQueryInfluencers.getEnabledFilters().values().iterator();
while ( iter.hasNext() ) {
- String filterName = ( String ) iter.next();
- ( ( FilterImpl ) loadQueryInfluencers.getEnabledFilter( filterName ) )
- .afterDeserialize( factory );
+ ( ( FilterImpl ) iter.next() ).afterDeserialize( factory );
}
if ( isRootSession && childSessionsByEntityMode != null ) {
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/impl/FilterImpl.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/impl/FilterImpl.java
@@ -51,7 +51,6 @@ public class FilterImpl implements Filte
void afterDeserialize(SessionFactoryImpl factory) {
definition = factory.getFilterDefinition(filterName);
- validate();
}
/**
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/impl/StatelessSessionImpl.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/impl/StatelessSessionImpl.java
@@ -179,9 +179,7 @@ public class StatelessSessionImpl extend
errorIfClosed();
Object result = getFactory().getEntityPersister(entityName)
.load(id, null, lockMode, this);
- if (temporaryPersistenceContext.isLoadFinished()) {
- temporaryPersistenceContext.clear();
- }
+ temporaryPersistenceContext.clear();
return result;
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
@@ -204,8 +204,6 @@ public final class SessionFactoryImpl im
Constructor constructor = concurrentStatsClass.getConstructor(new Class[]{SessionFactoryImplementor.class});
concurrentStatistics = (Statistics) constructor.newInstance(new Object[]{this});
log.trace("JDK 1.5 concurrent classes present");
- } catch ( NoClassDefFoundError noJava5 ) {
- log.trace("JDK 1.5 concurrent classes missing");
} catch (Exception noJava5) {
log.trace("JDK 1.5 concurrent classes missing");
}
--- libhibernate3-java-3.5.4.Final.orig/core/src/main/java/org/hibernate/cfg/Configuration.java
+++ libhibernate3-java-3.5.4.Final/core/src/main/java/org/hibernate/cfg/Configuration.java
@@ -2718,15 +2718,12 @@ public class Configuration implements Se
finalName = ( String ) binding.logicalToPhysical.get( logicalName );
}
String key = buildTableNameKey(
- currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
+ currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName()
);
TableDescription description = ( TableDescription ) tableNameBinding.get( key );
if ( description != null ) {
currentTable = description.denormalizedSupertable;
}
- else {
- currentTable = null;
- }
} while ( finalName == null && currentTable != null );
if ( finalName == null ) {
@@ -2747,15 +2744,12 @@ public class Configuration implements Se
logical = ( String ) binding.physicalToLogical.get( physicalName );
}
String key = buildTableNameKey(
- currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
+ currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName()
);
description = ( TableDescription ) tableNameBinding.get( key );
if ( description != null ) {
currentTable = description.denormalizedSupertable;
}
- else {
- currentTable = null;
- }
}
while ( logical == null && currentTable != null && description != null );
if ( logical == null ) {
--- libhibernate3-java-3.5.4.Final.orig/cache-swarmcache/pom.xml
+++ libhibernate3-java-3.5.4.Final/cache-swarmcache/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/jdbc3-testing/pom.xml
+++ libhibernate3-java-3.5.4.Final/jdbc3-testing/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/jmx/pom.xml
+++ libhibernate3-java-3.5.4.Final/jmx/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/connection-proxool/pom.xml
+++ libhibernate3-java-3.5.4.Final/connection-proxool/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/cache-infinispan/pom.xml
+++ libhibernate3-java-3.5.4.Final/cache-infinispan/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java
+++ libhibernate3-java-3.5.4.Final/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java
@@ -415,32 +415,6 @@ public class InfinispanRegionFactoryTest
}
}
- public void testBuildQueryRegionWithCustomRegionName() {
- final String queryRegionName = "myquery";
- Properties p = new Properties();
- InfinispanRegionFactory factory = new InfinispanRegionFactory();
- p.setProperty("hibernate.cache.infinispan.myquery.cfg", "timestamps-none-eviction");
- p.setProperty("hibernate.cache.infinispan.myquery.eviction.strategy", "FIFO");
- p.setProperty("hibernate.cache.infinispan.myquery.eviction.wake_up_interval", "2222");
- p.setProperty("hibernate.cache.infinispan.myquery.eviction.max_entries", "11111");
- factory.start(null, p);
- CacheManager manager = factory.getCacheManager();
- manager.getGlobalConfiguration().setTransportClass(null);
- try {
- assertTrue(factory.getDefinedConfigurations().contains("local-query"));
- QueryResultsRegionImpl region = (QueryResultsRegionImpl) factory.buildQueryResultsRegion(queryRegionName, p);
- assertNotNull(factory.getTypeOverrides().get(queryRegionName));
- assertTrue(factory.getDefinedConfigurations().contains(queryRegionName));
- CacheAdapter cache = region.getCacheAdapter();
- Configuration cacheCfg = cache.getConfiguration();
- assertEquals(EvictionStrategy.FIFO, cacheCfg.getEvictionStrategy());
- assertEquals(2222, cacheCfg.getEvictionWakeUpInterval());
- assertEquals(11111, cacheCfg.getEvictionMaxEntries());
- } finally {
- factory.stop();
- }
- }
-
public void testEnableStatistics() {
Properties p = new Properties();
p.setProperty("hibernate.cache.infinispan.statistics", "true");
--- libhibernate3-java-3.5.4.Final.orig/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/IsolatedClassLoaderTest.java
+++ libhibernate3-java-3.5.4.Final/cache-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/classloader/IsolatedClassLoaderTest.java
@@ -88,7 +88,6 @@ public class IsolatedClassLoaderTest ext
protected void standardConfigure(Configuration cfg) {
super.standardConfigure(cfg);
cfg.setProperty(InfinispanRegionFactory.QUERY_CACHE_RESOURCE_PROP, "replicated-query");
- cfg.setProperty("hibernate.cache.infinispan.AccountRegion.cfg", "replicated-query");
}
@@ -165,25 +164,15 @@ public class IsolatedClassLoaderTest ext
// Bind a listener to the "local" cache
// Our region factory makes its CacheManager available to us
CacheManager localManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.LOCAL);
- // Bind a listener to the "remote" cache
- CacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
- String cacheName;
- if (useNamedRegion) {
- cacheName = "AccountRegion"; // As defined by ClassLoaderTestDAO via calls to query.setCacheRegion
- // Define cache configurations for region early to avoid ending up with local caches for this region
- localManager.defineConfiguration(cacheName, "replicated-query", new org.infinispan.config.Configuration());
- remoteManager.defineConfiguration(cacheName, "replicated-query", new org.infinispan.config.Configuration());
- } else {
- cacheName = "replicated-query";
- }
-
- localQueryCache = localManager.getCache(cacheName);
+ localQueryCache = localManager.getCache("replicated-query");
localQueryListener = new CacheAccessListener();
localQueryCache.addListener(localQueryListener);
TransactionManager localTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestCase.LOCAL);
- remoteQueryCache = remoteManager.getCache(cacheName);
+ // Bind a listener to the "remote" cache
+ CacheManager remoteManager = ClusterAwareRegionFactory.getCacheManager(DualNodeTestCase.REMOTE);
+ remoteQueryCache = remoteManager.getCache("replicated-query");
remoteQueryListener = new CacheAccessListener();
remoteQueryCache.addListener(remoteQueryListener);
--- libhibernate3-java-3.5.4.Final.orig/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
+++ libhibernate3-java-3.5.4.Final/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
@@ -51,15 +51,7 @@ public class JndiInfinispanRegionFactory
* There is no default value -- the user must specify the property.
*/
public static final String CACHE_MANAGER_RESOURCE_PROP = "hibernate.cache.infinispan.cachemanager";
-
- public JndiInfinispanRegionFactory() {
- super();
- }
-
- public JndiInfinispanRegionFactory(Properties props) {
- super(props);
- }
-
+
@Override
protected CacheManager createCacheManager(Properties properties) throws CacheException {
String name = PropertiesHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);
--- libhibernate3-java-3.5.4.Final.orig/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
+++ libhibernate3-java-3.5.4.Final/cache-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
@@ -99,7 +99,7 @@ public class InfinispanRegionFactory imp
/**
* Name of the configuration that should be used for timestamp caches.
*
- * @see #DEF_TIMESTAMPS_RESOURCE
+ * @see #DEF_TS_RESOURCE
*/
public static final String TIMESTAMPS_CACHE_RESOURCE_PROP = PREFIX + TIMESTAMPS_KEY + CONFIG_SUFFIX;
@@ -113,7 +113,7 @@ public class InfinispanRegionFactory imp
public static final String QUERY_CACHE_RESOURCE_PROP = PREFIX + QUERY_KEY + CONFIG_SUFFIX;
/**
- * Default value for {@link #INFINISPAN_CONFIG_RESOURCE_PROP}. Specifies the "infinispan-configs.xml" file in this package.
+ * Default value for {@link #INFINISPAN_RESOURCE_PROP}. Specifies the "infinispan-configs.xml" file in this package.
*/
public static final String DEF_INFINISPAN_CONFIG_RESOURCE = "org/hibernate/cache/infinispan/builder/infinispan-configs.xml";
@@ -159,7 +159,7 @@ public class InfinispanRegionFactory imp
/** {@inheritDoc} */
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException {
- if (log.isDebugEnabled()) log.debug("Building collection cache region [" + regionName + "]");
+ log.debug("Building collection cache region [" + regionName + "]");
Cache cache = getCache(regionName, COLLECTION_KEY, properties);
CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(cache);
CollectionRegionImpl region = new CollectionRegionImpl(cacheAdapter, regionName, metadata, transactionManager, this);
@@ -182,14 +182,9 @@ public class InfinispanRegionFactory imp
*/
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
throws CacheException {
- if (log.isDebugEnabled()) log.debug("Building query results cache region [" + regionName + "]");
+ log.debug("Building query results cache region [" + regionName + "]");
String cacheName = typeOverrides.get(QUERY_KEY).getCacheName();
- // If region name is not default one, lookup a cache for that region name
- if (!regionName.equals("org.hibernate.cache.StandardQueryCache"))
- cacheName = regionName;
-
- Cache cache = getCache(cacheName, QUERY_KEY, properties);
- CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(cache);
+ CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(manager.getCache(cacheName));
QueryResultsRegionImpl region = new QueryResultsRegionImpl(cacheAdapter, regionName, properties, transactionManager, this);
region.start();
return region;
@@ -200,7 +195,7 @@ public class InfinispanRegionFactory imp
*/
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
throws CacheException {
- if (log.isDebugEnabled()) log.debug("Building timestamps cache region [" + regionName + "]");
+ log.debug("Building timestamps cache region [" + regionName + "]");
String cacheName = typeOverrides.get(TIMESTAMPS_KEY).getCacheName();
CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(manager.getCache(cacheName));
TimestampsRegionImpl region = new TimestampsRegionImpl(cacheAdapter, regionName, transactionManager, this);
@@ -374,7 +369,7 @@ public class InfinispanRegionFactory imp
String templateCacheName = null;
Configuration regionCacheCfg = null;
if (regionOverride != null) {
- if (log.isDebugEnabled()) log.debug("Cache region specific configuration exists: " + regionOverride);
+ if (log.isDebugEnabled()) log.debug("Entity cache region specific configuration exists: " + regionOverride);
regionOverride = overrideStatisticsIfPresent(regionOverride, properties);
regionCacheCfg = regionOverride.createInfinispanConfiguration();
String cacheName = regionOverride.getCacheName();
@@ -417,4 +412,4 @@ public class InfinispanRegionFactory imp
}
return override;
}
-}
+}
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/jdbc4-testing/pom.xml
+++ libhibernate3-java-3.5.4.Final/jdbc4-testing/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/connection-c3p0/pom.xml
+++ libhibernate3-java-3.5.4.Final/connection-c3p0/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/parent/pom.xml
+++ libhibernate3-java-3.5.4.Final/parent/pom.xml
@@ -29,7 +29,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<packaging>pom</packaging>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<name>Hibernate Core Parent POM</name>
<description>The base POM for all Hibernate Core modules.</description>
@@ -539,11 +539,6 @@
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
</dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.2</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -574,6 +569,7 @@
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -623,16 +619,16 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
- <version>5.0.8</version>
+ <version>5.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/hibbr35</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com/hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -644,16 +640,16 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
- <version>5.1.12</version>
+ <version>5.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/hibbr35</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com/hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -672,10 +668,10 @@
<properties>
<db.dialect>org.hibernate.dialect.MySQL5Dialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql:loadbalance://dev61.qa.atl2.redhat.com:3306,dev62.qa.atl2.redhat.com:3306/hibbr35
+ <jdbc.url>jdbc:mysql:loadbalance://dev61.qa.atl2.redhat.com:3306,dev62.qa.atl2.redhat.com:3306/hibbrtru
</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -687,16 +683,16 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.4-701.jdbc3</version>
+ <version>8.2-504.jdbc3</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
<jdbc.driver>org.postgresql.Driver</jdbc.driver>
- <jdbc.url>jdbc:postgresql://vmg01.mw.lab.eng.bos.redhat.com:5432:hibbr35</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:postgresql://vmg01.mw.lab.eng.bos.redhat.com:5432:hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -708,16 +704,16 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.4-701.jdbc3</version>
+ <version>8.2-504.jdbc3</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
<jdbc.driver>org.postgresql.Driver</jdbc.driver>
- <jdbc.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:hibbr35</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:postgresql://vmg03.mw.lab.eng.bos.redhat.com:5432:hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -748,8 +744,8 @@
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
<jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -774,8 +770,8 @@
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
<jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -787,7 +783,7 @@
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
- <version>3.58.82</version>
+ <version>3.57.86</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -800,8 +796,8 @@
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
<jdbc.url>jdbc:db2://vmg06.mw.lab.eng.bos.redhat.com:50000/jbossqa</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -822,8 +818,8 @@
<db.dialect>org.hibernate.dialect.Oracle9iDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -836,7 +832,7 @@
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<!-- use the 10g drivers which are surprisingly largely bug free -->
- <version>10.2.0.4</version>
+ <version>10.0.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -844,8 +840,8 @@
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@vmg05.mw.lab.eng.bos.redhat.com:1521:qaora10</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -864,10 +860,9 @@
<properties>
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
- <!-- fall back to oracle 11g r1, once the account be setup, we should change this back <jdbc.url>jdbc:oracle:thin:@vmg27.mw.lab.eng.bos.redhat.com:1521:qaora11</jdbc.url> -->
-<jdbc.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:oracle:thin:@dev04.qa.atl2.redhat.com:1521:qaora11</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -886,12 +881,11 @@
<properties>
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
-<!-- fall back to oracle 11g r1, once the account be setup, we should change this back <jdbc.url>jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg27-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg28-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))</jdbc.url>
- --><jdbc.url>
- jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg24-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg25-vip.mw.lab.eng.bos.redhat.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))
+ <jdbc.url>
+ jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=vmg24-vip.mw.lab.eng.bos.redhat.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=vmg25-vip.mw.lab.eng.bos.redhat.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=qarac.jboss)))
</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -910,9 +904,9 @@
<properties>
<db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
<jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
- <jdbc.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/hibbr35?DYNAMIC_PREPARE=true</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.url>jdbc:sybase:Tds:vmg07.mw.lab.eng.bos.redhat.com:5000/hibbrtru</jdbc.url>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -932,8 +926,8 @@
<db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
<jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
<jdbc.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation>4096</jdbc.isolation>
</properties>
</profile>
@@ -953,8 +947,8 @@
<db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
<jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
<jdbc.url>jdbc:sqlserver://vmg04.mw.lab.eng.bos.redhat.com:1433</jdbc.url>
- <jdbc.user>hibbr35</jdbc.user>
- <jdbc.pass>hibbr35</jdbc.pass>
+ <jdbc.user>hibbrtru</jdbc.user>
+ <jdbc.pass>hibbrtru</jdbc.pass>
<jdbc.isolation>4096</jdbc.isolation>
</properties>
</profile>
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/pom.xml
+++ libhibernate3-java-3.5.4.Final/entitymanager/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
@@ -1,3 +1,4 @@
+// $Id: TestCase.java 18931 2010-03-05 22:22:05Z smarlow@redhat.com $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -35,8 +36,8 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Environment;
@@ -52,7 +53,8 @@ import org.hibernate.test.annotations.Hi
* @author Hardy Ferentschik
*/
public abstract class TestCase extends HibernateTestCase {
- private static final Logger log = LoggerFactory.getLogger( TestCase.class );
+
+ private static final Log log = LogFactory.getLog( TestCase.class );
protected static EntityManagerFactory factory;
private EntityManager em;
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/metadata/MetadataTest.java
@@ -38,10 +38,7 @@ import javax.persistence.metamodel.ListA
import javax.persistence.metamodel.MappedSuperclassType;
import javax.persistence.metamodel.IdentifiableType;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.ejb.metamodel.MetamodelImpl;
import org.hibernate.ejb.test.TestCase;
-import org.hibernate.engine.SessionFactoryImplementor;
/**
* @author Emmanuel Bernard
@@ -55,16 +52,6 @@ public class MetadataTest extends TestCa
assertNotNull( entityType );
}
- @SuppressWarnings({ "unchecked" })
- public void testBuildingMetamodelWithParameterizedCollection() {
- AnnotationConfiguration cfg = new AnnotationConfiguration( );
- configure( cfg );
- cfg.addAnnotatedClass( WithGenericCollection.class );
- cfg.buildMappings();
- SessionFactoryImplementor sfi = (SessionFactoryImplementor) cfg.buildSessionFactory();
- MetamodelImpl.buildMetamodel( cfg.getClassMappings(), sfi );
- }
-
public void testLogicalManyToOne() throws Exception {
final EntityType<JoinedManyToOneOwner> entityType = factory.getMetamodel().entity( JoinedManyToOneOwner.class );
final SingularAttribute attr = entityType.getDeclaredSingularAttribute( "house" );
@@ -111,7 +98,7 @@ public class MetadataTest extends TestCa
assertNotNull( houseId );
assertTrue( houseId.isId() );
assertEquals( Attribute.PersistentAttributeType.EMBEDDED, houseId.getPersistentAttributeType() );
-
+
final EntityType<Person> personType = factory.getMetamodel().entity( Person.class );
assertFalse( personType.hasSingleIdAttribute() );
final Set<SingularAttribute<? super Person,?>> ids = personType.getIdClassAttributes();
@@ -231,7 +218,7 @@ public class MetadataTest extends TestCa
assertTrue( cat.hasVersionAttribute() );
assertEquals( "version", cat.getVersion(Long.class).getName() );
- verifyDeclaredVersionNotPresent( cat );
+ verifyDeclaredVersiobnNotPresent( cat );
verifyDeclaredIdNotPresentAndIdPresent(cat);
assertEquals( Type.PersistenceType.MAPPED_SUPERCLASS, cat.getSupertype().getPersistenceType() );
@@ -242,7 +229,7 @@ public class MetadataTest extends TestCa
assertTrue( cattish.hasVersionAttribute() );
assertEquals( "version", cattish.getVersion(Long.class).getName() );
- verifyDeclaredVersionNotPresent( cattish );
+ verifyDeclaredVersiobnNotPresent( cattish );
verifyDeclaredIdNotPresentAndIdPresent(cattish);
assertEquals( Type.PersistenceType.ENTITY, cattish.getSupertype().getPersistenceType() );
@@ -253,7 +240,7 @@ public class MetadataTest extends TestCa
assertTrue( feline.hasVersionAttribute() );
assertEquals( "version", feline.getVersion(Long.class).getName() );
- verifyDeclaredVersionNotPresent( feline );
+ verifyDeclaredVersiobnNotPresent( feline );
verifyDeclaredIdNotPresentAndIdPresent(feline);
assertEquals( Type.PersistenceType.MAPPED_SUPERCLASS, feline.getSupertype().getPersistenceType() );
@@ -264,7 +251,7 @@ public class MetadataTest extends TestCa
assertTrue( animal.hasVersionAttribute() );
assertEquals( "version", animal.getVersion(Long.class).getName() );
- verifyDeclaredVersionNotPresent( animal );
+ verifyDeclaredVersiobnNotPresent( animal );
assertEquals( "id", animal.getId(Long.class).getName() );
final SingularAttribute<Animal, Long> id = animal.getDeclaredId( Long.class );
assertEquals( "id", id.getName() );
@@ -331,7 +318,7 @@ public class MetadataTest extends TestCa
}
}
- private void verifyDeclaredVersionNotPresent(IdentifiableType<?> type) {
+ private void verifyDeclaredVersiobnNotPresent(IdentifiableType<?> type) {
try {
type.getDeclaredVersion(Long.class);
fail("Should not have a declared version");
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/util/Book.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/util/Book.java
@@ -8,18 +8,10 @@ import javax.persistence.GeneratedValue;
* @author Emmanuel Bernard
*/
@Entity
-public class Book extends CopyrightableContent {
+public class Book {
private Long id;
private String name;
- public Book() {
- super();
- }
-
- public Book(Author a) {
- super(a);
- }
-
@Id
@GeneratedValue
public Long getId() {
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/util/GetIdentifierTest.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/util/GetIdentifierTest.java
@@ -56,8 +56,7 @@ public class GetIdentifierTest extends T
return new Class[] {
Book.class,
Umbrella.class,
- Sickness.class,
- Author.class
+ Sickness.class
};
}
}
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/packaging/ScannerTest.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/packaging/ScannerTest.java
@@ -1,4 +1,4 @@
-// $Id: ScannerTest.java 19666 2010-06-02 14:48:41Z epbernard $
+// $Id: ScannerTest.java 19060 2010-03-22 14:40:05Z epbernard $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -35,7 +35,6 @@ import javax.persistence.EntityManagerFa
import javax.persistence.MappedSuperclass;
import javax.persistence.Persistence;
-import org.hibernate.ejb.AvailableSettings;
import org.hibernate.ejb.packaging.NamedInputStream;
import org.hibernate.ejb.packaging.NativeScanner;
import org.hibernate.ejb.packaging.Scanner;
@@ -83,25 +82,13 @@ public class ScannerTest extends Packagi
EntityManagerFactory emf;
CustomScanner.resetUsed();
- final HashMap integration = new HashMap();
- emf = Persistence.createEntityManagerFactory( "defaultpar", integration );
+ emf = Persistence.createEntityManagerFactory( "defaultpar", new HashMap() );
assertTrue( ! CustomScanner.isUsed() );
emf.close();
CustomScanner.resetUsed();
- emf = Persistence.createEntityManagerFactory( "manager1", integration );
+ emf = Persistence.createEntityManagerFactory( "manager1", new HashMap() );
assertTrue( CustomScanner.isUsed() );
emf.close();
-
- CustomScanner.resetUsed();
- integration.put( AvailableSettings.SCANNER, new CustomScanner() );
- emf = Persistence.createEntityManagerFactory( "defaultpar", integration );
- assertTrue( CustomScanner.isUsed() );
- emf.close();
-
- CustomScanner.resetUsed();
- emf = Persistence.createEntityManagerFactory( "defaultpar", null );
- assertTrue( ! CustomScanner.isUsed() );
- emf.close();
}
}
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/EntityManagerSerializationTest.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/test/ejb3configuration/EntityManagerSerializationTest.java
@@ -1,4 +1,4 @@
-//$Id: EntityManagerSerializationTest.java 19602 2010-05-25 13:30:22Z epbernard $
+//$Id: EntityManagerSerializationTest.java 14824 2008-06-29 13:47:11Z hardy.ferentschik $
package org.hibernate.ejb.test.ejb3configuration;
import java.io.ByteArrayInputStream;
@@ -32,10 +32,10 @@ public class EntityManagerSerializationT
stream.close();
ByteArrayInputStream byteIn = new ByteArrayInputStream( serialized );
ObjectInputStream in = new ObjectInputStream( byteIn );
- EntityManagerFactory serializedFactory = (EntityManagerFactory) in.readObject();
+ EntityManagerFactory seriallizedFactory = (EntityManagerFactory) in.readObject();
in.close();
byteIn.close();
- EntityManager em = serializedFactory.createEntityManager();
+ EntityManager em = seriallizedFactory.createEntityManager();
//em.getTransaction().begin();
//em.setFlushMode( FlushModeType.NEVER );
Cat cat = new Cat();
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/test/java/org/hibernate/ejb/criteria/basic/ExpressionsTest.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/test/java/org/hibernate/ejb/criteria/basic/ExpressionsTest.java
@@ -25,7 +25,6 @@ package org.hibernate.ejb.criteria.basic
import java.math.BigDecimal;
import java.math.BigInteger;
-import java.util.Collections;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
@@ -59,7 +58,7 @@ public class ExpressionsTest extends Abs
product.setId( "product1" );
product.setPrice( 1.23d );
product.setQuantity( 2 );
- product.setPartNumber( ((long)Integer.MAX_VALUE) + 1 );
+ product.setPartNumber( Integer.MAX_VALUE + 1 );
product.setRating( 1.999f );
product.setSomeBigInteger( BigInteger.valueOf( 987654321 ) );
product.setSomeBigDecimal( BigDecimal.valueOf( 987654.321 ) );
@@ -247,40 +246,4 @@ public class ExpressionsTest extends Abs
AbstractQueryImpl hqlQueryImpl = (AbstractQueryImpl) query;
return hqlQueryImpl.getParameterMetadata().getNamedParameterNames().size();
}
-
- public void testInExplicitTupleList() {
- EntityManager em = getOrCreateEntityManager();
- em.getTransaction().begin();
- CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
- Root<Product> from = criteria.from( Product.class );
- criteria.where( from.get( Product_.partNumber ).in( Collections.singletonList( ((long)Integer.MAX_VALUE) + 1 ) ) );
- List<Product> result = em.createQuery( criteria ).getResultList();
- assertEquals( 1, result.size() );
- em.getTransaction().commit();
- em.close();
- }
-
- public void testInExplicitTupleListVarargs() {
- EntityManager em = getOrCreateEntityManager();
- em.getTransaction().begin();
- CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
- Root<Product> from = criteria.from( Product.class );
- criteria.where( from.get( Product_.partNumber ).in( ((long)Integer.MAX_VALUE) + 1 ) );
- List<Product> result = em.createQuery( criteria ).getResultList();
- assertEquals( 1, result.size() );
- em.getTransaction().commit();
- em.close();
- }
-
- public void testInExpressionVarargs() {
- EntityManager em = getOrCreateEntityManager();
- em.getTransaction().begin();
- CriteriaQuery<Product> criteria = builder.createQuery( Product.class );
- Root<Product> from = criteria.from( Product.class );
- criteria.where( from.get( Product_.partNumber ).in( from.get( Product_.partNumber ) ) );
- List<Product> result = em.createQuery( criteria ).getResultList();
- assertEquals( 1, result.size() );
- em.getTransaction().commit();
- em.close();
- }
}
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/HibernatePersistence.java
@@ -38,7 +38,6 @@ import org.hibernate.ejb.util.Persistenc
* @author Gavin King
*/
public class HibernatePersistence extends AvailableSettings implements PersistenceProvider {
- private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache();
/**
* Get an entity manager factory by its entity manager name, using the specified
@@ -86,11 +85,11 @@ public class HibernatePersistence extend
private final ProviderUtil providerUtil = new ProviderUtil() {
public LoadState isLoadedWithoutReference(Object proxy, String property) {
- return PersistenceUtilHelper.isLoadedWithoutReference( proxy, property, cache );
+ return PersistenceUtilHelper.isLoadedWithoutReference( proxy, property );
}
public LoadState isLoadedWithReference(Object proxy, String property) {
- return PersistenceUtilHelper.isLoadedWithReference( proxy, property, cache );
+ return PersistenceUtilHelper.isLoadedWithReference( proxy, property );
}
public LoadState isLoaded(Object o) {
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/Ejb3Configuration.java
@@ -1,4 +1,4 @@
-// $Id: Ejb3Configuration.java 19664 2010-06-02 13:15:29Z epbernard $
+// $Id: Ejb3Configuration.java 19331 2010-04-30 19:33:42Z gbadner $
/*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
@@ -328,7 +328,7 @@ public class Ejb3Configuration implement
Scanner scanner = null;
URL jarURL = null;
if ( metadata.getName() == null ) {
- scanner = buildScanner( metadata.getProps(), integration );
+ scanner = buildScanner( metadata.getProps() );
jarURL = JarVisitorFactory.getJarURLFromURLEntry( url, "/META-INF/persistence.xml" );
metadata.setName( scanner.getUnqualifiedJarName(jarURL) );
}
@@ -337,7 +337,7 @@ public class Ejb3Configuration implement
}
else if ( persistenceUnitName == null || metadata.getName().equals( persistenceUnitName ) ) {
if (scanner == null) {
- scanner = buildScanner( metadata.getProps(), integration );
+ scanner = buildScanner( metadata.getProps() );
jarURL = JarVisitorFactory.getJarURLFromURLEntry( url, "/META-INF/persistence.xml" );
}
//scan main JAR
@@ -377,12 +377,8 @@ public class Ejb3Configuration implement
}
}
- private Scanner buildScanner(Properties properties, Map<?,?> integration) {
- //read the String or Instance from the integration map first and use the properties as a backup.
- Object scanner = integration.get( AvailableSettings.SCANNER );
- if (scanner == null) {
- scanner = properties.getProperty( AvailableSettings.SCANNER );
- }
+ private Scanner buildScanner(Properties properties) {
+ final Object scanner = properties.getProperty( AvailableSettings.SCANNER );
if (scanner != null) {
Class<?> scannerClass;
if ( scanner instanceof String ) {
@@ -573,7 +569,7 @@ public class Ejb3Configuration implement
ScanningContext context = new ScanningContext();
final Properties copyOfProperties = (Properties) info.getProperties().clone();
ConfigurationHelper.overrideProperties( copyOfProperties, integration );
- context.scanner( buildScanner( copyOfProperties, integration ) )
+ context.scanner( buildScanner( copyOfProperties ) )
.searchOrm( searchForORMFiles )
.explicitMappingFiles( null ); //URLs provided by the container already
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/EntityManagerFactoryImpl.java
@@ -65,7 +65,6 @@ public class EntityManagerFactoryImpl im
private final Metamodel metamodel;
private final HibernatePersistenceUnitUtil util;
private final Map<String,Object> properties;
- private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache();
@SuppressWarnings( "unchecked" )
public EntityManagerFactoryImpl(
@@ -183,15 +182,13 @@ public class EntityManagerFactoryImpl im
private static class HibernatePersistenceUnitUtil implements PersistenceUnitUtil, Serializable {
private final HibernateEntityManagerFactory emf;
- private transient PersistenceUtilHelper.MetadataCache cache;
private HibernatePersistenceUnitUtil(EntityManagerFactoryImpl emf) {
this.emf = emf;
- this.cache = emf.cache;
}
public boolean isLoaded(Object entity, String attributeName) {
- LoadState state = PersistenceUtilHelper.isLoadedWithoutReference( entity, attributeName, cache );
+ LoadState state = PersistenceUtilHelper.isLoadedWithoutReference( entity, attributeName );
if (state == LoadState.LOADED) {
return true;
}
@@ -199,7 +196,7 @@ public class EntityManagerFactoryImpl im
return false;
}
else {
- return PersistenceUtilHelper.isLoadedWithReference( entity, attributeName, cache ) != LoadState.NOT_LOADED;
+ return PersistenceUtilHelper.isLoadedWithReference( entity, attributeName ) != LoadState.NOT_LOADED;
}
}
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java
@@ -618,14 +618,6 @@ public class AttributeFactory {
return member;
}
- public String getMemberDescription() {
- return determineMemberDescription( getMember() );
- }
-
- public String determineMemberDescription(Member member) {
- return member.getDeclaringClass().getName() + '#' + member.getName();
- }
-
public Class<Y> getJavaType() {
return javaType;
}
@@ -831,23 +823,20 @@ public class AttributeFactory {
}
private Class<?> getClassFromGenericArgument(java.lang.reflect.Type type) {
- if ( type instanceof Class ) {
- return (Class) type;
- }
- else if ( type instanceof TypeVariable ) {
- final java.lang.reflect.Type upperBound = ( ( TypeVariable ) type ).getBounds()[0];
- return getClassFromGenericArgument( upperBound );
- }
- else if ( type instanceof ParameterizedType ) {
- final java.lang.reflect.Type rawType = ( (ParameterizedType) type ).getRawType();
- return getClassFromGenericArgument( rawType );
+ Class<?> javaType;
+ Object unsafeElementType = type;
+ if ( unsafeElementType instanceof Class ) {
+ javaType = (Class) unsafeElementType;
+ }
+ else if ( unsafeElementType instanceof TypeVariable ) {
+ final java.lang.reflect.Type upperBound = ( ( TypeVariable ) unsafeElementType ).getBounds()[0];
+ javaType = getClassFromGenericArgument( upperBound );
}
else {
- throw new AssertionFailure(
- "Fail to process type argument in a generic declaration. Member : " + getMemberDescription()
- + " Type: " + type.getClass()
- );
+ throw new AssertionFailure("Fail to process type argument in a generic declaration. Type: "
+ + type.getClass() );
}
+ return javaType;
}
public ValueContext getElementValueContext() {
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/util/PersistenceUtilHelper.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/util/PersistenceUtilHelper.java
@@ -1,20 +1,14 @@
package org.hibernate.ejb.util;
-import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
import java.lang.reflect.AccessibleObject;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
import javax.persistence.spi.LoadState;
import javax.persistence.PersistenceException;
-import org.hibernate.AssertionFailure;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.intercept.FieldInterceptionHelper;
@@ -23,10 +17,9 @@ import org.hibernate.collection.Persiste
/**
* @author Emmanuel Bernard
- * @author Hardy Ferentschik
*/
public class PersistenceUtilHelper {
- public static LoadState isLoadedWithoutReference(Object proxy, String property, MetadataCache cache) {
+ public static LoadState isLoadedWithoutReference(Object proxy, String property) {
Object entity;
boolean sureFromUs = false;
if ( proxy instanceof HibernateProxy ) {
@@ -51,7 +44,7 @@ public class PersistenceUtilHelper {
if (isInitialized && interceptor != null) {
//property is loaded according to bytecode enhancement, but is it loaded as far as association?
//it's ours, we can read
- state = isLoaded( get( entity, property, cache ) );
+ state = isLoaded( get( entity, property ) );
//it's ours so we know it's loaded
if (state == LoadState.UNKNOWN) state = LoadState.LOADED;
}
@@ -61,7 +54,7 @@ public class PersistenceUtilHelper {
else if ( sureFromUs ) { //interceptor == null
//property is loaded according to bytecode enhancement, but is it loaded as far as association?
//it's ours, we can read
- state = isLoaded( get( entity, property, cache ) );
+ state = isLoaded( get( entity, property ) );
//it's ours so we know it's loaded
if (state == LoadState.UNKNOWN) state = LoadState.LOADED;
}
@@ -78,25 +71,31 @@ public class PersistenceUtilHelper {
}
}
- public static LoadState isLoadedWithReference(Object proxy, String property, MetadataCache cache) {
+ public static LoadState isLoadedWithReference(Object proxy, String property) {
//for sure we don't instrument and for sure it's not a lazy proxy
- Object object = get(proxy, property, cache);
+ Object object = get(proxy, property);
return isLoaded( object );
}
- private static Object get(Object proxy, String property, MetadataCache cache) {
+ private static Object get(Object proxy, String property) {
final Class<?> clazz = proxy.getClass();
-
try {
- Member member = cache.getMember( clazz, property );
- if (member instanceof Field) {
- return ( (Field) member ).get( proxy );
- }
- else if (member instanceof Method) {
- return ( (Method) member ).invoke( proxy );
- }
- else {
- throw new AssertionFailure( "Member object neither Field nor Method: " + member);
+ try {
+ final Field field = clazz.getField( property );
+ setAccessibility( field );
+ return field.get( proxy );
+ }
+ catch ( NoSuchFieldException e ) {
+ final Method method = getMethod( clazz, property );
+ if (method != null) {
+ setAccessibility( method );
+ return method.invoke( proxy );
+ }
+ else {
+ throw new PersistenceException( "Unable to find field or method: "
+ + clazz + "#"
+ + property);
+ }
}
}
catch ( IllegalAccessException e ) {
@@ -111,25 +110,6 @@ public class PersistenceUtilHelper {
}
}
- private static void setAccessibility(Member member) {
- //Sun's ease of use, sigh...
- ( ( AccessibleObject ) member ).setAccessible( true );
- }
-
- public static LoadState isLoaded(Object o) {
- if ( o instanceof HibernateProxy ) {
- final boolean isInitialized = !( ( HibernateProxy ) o ).getHibernateLazyInitializer().isUninitialized();
- return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
- }
- else if ( o instanceof PersistentCollection ) {
- final boolean isInitialized = ( ( PersistentCollection ) o ).wasInitialized();
- return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
- }
- else {
- return LoadState.UNKNOWN;
- }
- }
-
/**
* Returns the method with the specified name or <code>null</code> if it does not exist.
*
@@ -144,10 +124,10 @@ public class PersistenceUtilHelper {
string[0] = Character.toUpperCase( string[0] );
methodName = new String( string );
try {
- return clazz.getDeclaredMethod( "get" + methodName );
+ return clazz.getMethod( "get" + methodName );
}
catch ( NoSuchMethodException e ) {
- return clazz.getDeclaredMethod( "is" + methodName );
+ return clazz.getMethod( "is" + methodName );
}
}
catch ( NoSuchMethodException e ) {
@@ -155,83 +135,24 @@ public class PersistenceUtilHelper {
}
}
- /**
- * Cache hierarchy and member resolution in a weak hash map
- */
- //TODO not really thread-safe
- public static class MetadataCache implements Serializable {
- private transient Map<Class<?>, ClassCache> classCache = new WeakHashMap<Class<?>, ClassCache>();
-
-
- private void readObject(java.io.ObjectInputStream stream) {
- classCache = new WeakHashMap<Class<?>, ClassCache>();
- }
-
- Member getMember(Class<?> clazz, String property) {
- ClassCache cache = classCache.get( clazz );
- if (cache == null) {
- cache = new ClassCache(clazz);
- classCache.put( clazz, cache );
- }
- Member member = cache.members.get( property );
- if ( member == null ) {
- member = findMember( clazz, property );
- cache.members.put( property, member );
- }
- return member;
- }
-
- private Member findMember(Class<?> clazz, String property) {
- final List<Class<?>> classes = getClassHierarchy( clazz );
-
- for (Class current : classes) {
- final Field field;
- try {
- field = current.getDeclaredField( property );
- setAccessibility( field );
- return field;
- }
- catch ( NoSuchFieldException e ) {
- final Method method = getMethod( current, property );
- if (method != null) {
- setAccessibility( method );
- return method;
- }
- }
- }
- //we could not find any match
- throw new PersistenceException( "Unable to find field or method: "
- + clazz + "#"
- + property);
+ private static void setAccessibility(Member member) {
+ if ( !Modifier.isPublic( member.getModifiers() ) ) {
+ //Sun's ease of use, sigh...
+ ( ( AccessibleObject ) member ).setAccessible( true );
}
+ }
- private List<Class<?>> getClassHierarchy(Class<?> clazz) {
- ClassCache cache = classCache.get( clazz );
- if (cache == null) {
- cache = new ClassCache(clazz);
- classCache.put( clazz, cache );
- }
- return cache.classHierarchy;
+ public static LoadState isLoaded(Object o) {
+ if ( o instanceof HibernateProxy ) {
+ final boolean isInitialized = !( ( HibernateProxy ) o ).getHibernateLazyInitializer().isUninitialized();
+ return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
}
-
- private static List<Class<?>> findClassHierarchy(Class<?> clazz) {
- List<Class<?>> classes = new ArrayList<Class<?>>();
- Class<?> current = clazz;
- do {
- classes.add( current );
- current = current.getSuperclass();
- }
- while ( current != null );
- return classes;
+ else if ( o instanceof PersistentCollection ) {
+ final boolean isInitialized = ( ( PersistentCollection ) o ).wasInitialized();
+ return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
}
-
- private static class ClassCache {
- List<Class<?>> classHierarchy;
- Map<String, Member> members = new HashMap<String, Member>();
-
- public ClassCache(Class<?> clazz) {
- classHierarchy = findClassHierarchy( clazz );
- }
+ else {
+ return LoadState.UNKNOWN;
}
}
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/ExpressionImpl.java
@@ -88,7 +88,7 @@ public abstract class ExpressionImpl<T>
* {@inheritDoc}
*/
public Predicate in(Collection<?> values) {
- return criteriaBuilder().in( this, values.toArray() );
+ return criteriaBuilder().in( this, values );
}
/**
--- libhibernate3-java-3.5.4.Final.orig/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java
+++ libhibernate3-java-3.5.4.Final/entitymanager/src/main/java/org/hibernate/ejb/event/EJB3FlushEventListener.java
@@ -28,7 +28,7 @@ import org.hibernate.util.IdentityMap;
/**
* In EJB3, it is the create operation that is cascaded to unmanaged
- * entities at flush time (instead of the save-update operation in
+ * ebtities at flush time (instead of the save-update operation in
* Hibernate).
*
* @author Gavin King
--- libhibernate3-java-3.5.4.Final.orig/hibernate-maven-plugin/pom.xml
+++ libhibernate3-java-3.5.4.Final/hibernate-maven-plugin/pom.xml
@@ -27,7 +27,7 @@
<parent>
<artifactId>hibernate-parent</artifactId>
<groupId>org.hibernate</groupId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/envers/pom.xml
+++ libhibernate3-java-3.5.4.Final/envers/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@@ -122,12 +122,6 @@
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
- <!-- For JTA tests -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-testing</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<dependencyManagement>
@@ -148,11 +142,6 @@
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-testing</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>3.2.0.ga</version>
--- libhibernate3-java-3.5.4.Final.orig/envers/src/test/resources/testng.xml
+++ libhibernate3-java-3.5.4.Final/envers/src/test/resources/testng.xml
@@ -41,10 +41,8 @@
<package name="org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.subclass" />
<package name="org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.joined" />
<package name="org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.union" />
- <package name="org.hibernate.envers.test.integration.jta" />
<package name="org.hibernate.envers.test.integration.manytomany" />
<package name="org.hibernate.envers.test.integration.manytomany.biowned" />
- <package name="org.hibernate.envers.test.integration.manytomany.inverseToSuperclass" />
<package name="org.hibernate.envers.test.integration.manytomany.sametable" />
<package name="org.hibernate.envers.test.integration.manytomany.ternary" />
<package name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
@@ -55,7 +53,6 @@
<package name="org.hibernate.envers.test.integration.notinsertable.manytoone" />
<package name="org.hibernate.envers.test.integration.onetomany" />
<package name="org.hibernate.envers.test.integration.onetomany.detached" />
- <package name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass" />
<package name="org.hibernate.envers.test.integration.onetoone.bidirectional" />
<package name="org.hibernate.envers.test.integration.onetoone.bidirectional.ids" />
<package name="org.hibernate.envers.test.integration.onetoone.unidirectional" />
@@ -72,13 +69,6 @@
<package name="org.hibernate.envers.test.integration.secondary.ids" />
<package name="org.hibernate.envers.test.integration.serialization" />
<package name="org.hibernate.envers.test.integration.superclass" />
-
- <package name="org.hibernate.envers.test.entityNames.auditedEntity" />
- <package name="org.hibernate.envers.test.entityNames.manyToManyAudited" />
- <package name="org.hibernate.envers.test.entityNames.oneToManyAudited" />
- <package name="org.hibernate.envers.test.entityNames.oneToManyNotAudited" />
- <package name="org.hibernate.envers.test.entityNames.singleAssociatedAudited" />
- <package name="org.hibernate.envers.test.entityNames.singleAssociatedNotAudited" />
</packages>
</test>
</suite>
--- libhibernate3-java-3.5.4.Final.orig/envers/src/test/resources/hibernate.test.cfg.xml
+++ libhibernate3-java-3.5.4.Final/envers/src/test/resources/hibernate.test.cfg.xml
@@ -12,10 +12,10 @@
<property name="format_sql">true</property>
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
+ <property name="connection.url">jdbc:h2:mem:envers</property>
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
- <!-- The connection URL is set in AbstractEntityTest -->
<!--<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>-->
<!--<property name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>-->
@@ -44,4 +44,4 @@
<listener class="org.hibernate.envers.event.AuditEventListener" />
</event>-->
</session-factory>
-</hibernate-configuration>
+</hibernate-configuration>
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java
+++ libhibernate3-java-3.5.4.Final/envers/src/test/java/org/hibernate/envers/test/AbstractEntityTest.java
@@ -27,14 +27,12 @@ import java.io.IOException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import org.hibernate.cfg.Environment;
-import org.hibernate.ejb.AvailableSettings;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.event.AuditEventListener;
-import org.hibernate.test.tm.ConnectionProviderImpl;
-import org.hibernate.test.tm.TransactionManagerLookupImpl;
-import org.testng.annotations.*;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterClass;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.event.*;
@@ -91,12 +89,7 @@ public abstract class AbstractEntityTest
if (audited) {
initListeners();
}
-
cfg.configure("hibernate.test.cfg.xml");
-
- // Separate database for each test class
- cfg.setProperty("hibernate.connection.url", "jdbc:h2:mem:" + this.getClass().getName());
-
configure(cfg);
emf = cfg.buildEntityManagerFactory();
@@ -120,10 +113,4 @@ public abstract class AbstractEntityTest
public Ejb3Configuration getCfg() {
return cfg;
}
-
- protected void addJTAConfig(Ejb3Configuration cfg) {
- cfg.setProperty("connection.provider_class", ConnectionProviderImpl.class.getName());
- cfg.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, TransactionManagerLookupImpl.class.getName());
- cfg.setProperty(AvailableSettings.TRANSACTION_TYPE, "JTA");
- }
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/AuditReader.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/AuditReader.java
@@ -32,7 +32,7 @@ import org.hibernate.envers.query.AuditQ
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
+ * @author Hernan Chanfreau
*/
public interface AuditReader {
/**
@@ -49,23 +49,6 @@ public interface AuditReader {
*/
<T> T find(Class<T> cls, Object primaryKey, Number revision) throws
IllegalArgumentException, NotAuditedException, IllegalStateException;
-
- /**
- * Find an entity by primary key at the given revision with the specified entityName.
- * @param cls Class of the entity.
- * @param entityName EntityName to find.
- * @param primaryKey Primary key of the entity.
- * @param revision Revision in which to get the entity.
- * @return The found entity instance at the given revision (its properties may be partially filled
- * if not all properties are audited) or null, if an entity with that id didn't exist at that
- * revision.
- * @throws IllegalArgumentException If cls or primaryKey is null or revision is less or equal to 0.
- * @throws NotAuditedException When entities of the given class are not audited.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- <T> T find(Class<T> cls, String entityName, Object primaryKey,
- Number revision) throws IllegalArgumentException,
- NotAuditedException, IllegalStateException;
/**
* Get a list of revision numbers, at which an entity was modified.
@@ -79,21 +62,6 @@ public interface AuditReader {
*/
List<Number> getRevisions(Class<?> cls, Object primaryKey)
throws IllegalArgumentException, NotAuditedException, IllegalStateException;
-
- /**
- * Get a list of revision numbers, at which an entity was modified, looking by entityName.
- * @param cls Class of the entity.
- * @param entityName EntityName to find.
- * @param primaryKey Primary key of the entity.
- * @return A list of revision numbers, at which the entity was modified, sorted in ascending order (so older
- * revisions come first).
- * @throws NotAuditedException When entities of the given class are not audited.
- * @throws IllegalArgumentException If cls or primaryKey is null.
- * @throws IllegalStateException If the associated entity manager is closed.
- */
- List<Number> getRevisions(Class<?> cls, String entityName, Object primaryKey)
- throws IllegalArgumentException, NotAuditedException,
- IllegalStateException;
/**
* Get the date, at which a revision was created.
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
@@ -80,7 +80,6 @@ import org.slf4j.LoggerFactory;
/**
* Generates metadata for a collection-valued property.
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public final class CollectionMetadataGenerator {
private static final Logger log = LoggerFactory.getLogger(CollectionMetadataGenerator.class);
@@ -209,7 +208,7 @@ public final class CollectionMetadataGen
// The mapper will only be used to map from entity to map, so no need to provide other details
// when constructing the PropertyData.
new PropertyData(auditMappedBy, null, null, null),
- referencingEntityName, false);
+ referencedEntityName, false);
// Checking if there's an index defined. If so, adding a mapper for it.
if (propertyAuditingData.getPositionMappedBy() != null) {
@@ -534,6 +533,7 @@ public final class CollectionMetadataGen
return middleEntityXmlId;
}
+ @SuppressWarnings({"unchecked"})
private String getMappedBy(Collection collectionValue) {
PersistentClass referencedClass = ((OneToMany) collectionValue.getElement()).getAssociatedClass();
@@ -543,31 +543,8 @@ public final class CollectionMetadataGen
return auditMappedBy;
}
- // searching in referenced class
- String mappedBy = this.searchMappedBy(referencedClass, collectionValue);
-
- if(mappedBy == null) {
- log.debug("Going to search the mapped by attribute for " + propertyName + " in superclasses of entity: " + referencedClass.getClassName());
-
- PersistentClass tempClass = referencedClass;
- while ((mappedBy == null) && (tempClass.getSuperclass() != null)) {
- log.debug("Searching in superclass: " + tempClass.getSuperclass().getClassName());
- mappedBy = this.searchMappedBy(tempClass.getSuperclass(), collectionValue);
- tempClass = tempClass.getSuperclass();
- }
- }
-
- if(mappedBy == null) {
- throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
- + referencedClass.getClassName() + "!");
- }
-
- return mappedBy;
- }
-
- @SuppressWarnings({"unchecked"})
- private String searchMappedBy(PersistentClass referencedClass, Collection collectionValue) {
Iterator<Property> assocClassProps = referencedClass.getPropertyIterator();
+
while (assocClassProps.hasNext()) {
Property property = assocClassProps.next();
@@ -575,10 +552,13 @@ public final class CollectionMetadataGen
collectionValue.getKey().getColumnIterator())) {
return property.getName();
}
- }
- return null;
+ }
+
+ throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
+ + referencingEntityName + "!");
}
+ @SuppressWarnings({"unchecked"})
private String getMappedBy(Table collectionTable, PersistentClass referencedClass) {
// If there's an @AuditMappedBy specified, returning it directly.
String auditMappedBy = propertyAuditingData.getAuditMappedBy();
@@ -586,31 +566,6 @@ public final class CollectionMetadataGen
return auditMappedBy;
}
- // searching in referenced class
- String mappedBy = this.searchMappedBy(referencedClass, collectionTable);
-
- // not found on referenced class, searching on superclasses
- if(mappedBy == null) {
- log.debug("Going to search the mapped by attribute for " + propertyName + " in superclases of entity: " + referencedClass.getClassName());
-
- PersistentClass tempClass = referencedClass;
- while ((mappedBy == null) && (tempClass.getSuperclass() != null)) {
- log.debug("Searching in superclass: " + tempClass.getSuperclass().getClassName());
- mappedBy = this.searchMappedBy(tempClass.getSuperclass(), collectionTable);
- tempClass = tempClass.getSuperclass();
- }
- }
-
- if(mappedBy == null) {
- throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
- + referencedClass.getClassName() + "!");
- }
-
- return mappedBy;
- }
-
- @SuppressWarnings({"unchecked"})
- private String searchMappedBy(PersistentClass referencedClass, Table collectionTable) {
Iterator<Property> properties = referencedClass.getPropertyIterator();
while (properties.hasNext()) {
Property property = properties.next();
@@ -621,8 +576,9 @@ public final class CollectionMetadataGen
return property.getName();
}
}
- }
- return null;
+ }
+
+ throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
+ + referencingEntityName + "!");
}
-
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/configuration/metadata/AuditMetadataGenerator.java
@@ -53,7 +53,6 @@ import org.slf4j.LoggerFactory;
* @author Adam Warski (adam at warski dot org)
* @author Sebastian Komander
* @author Tomasz Bech
- * @author Hernn Chanfreau
*/
public final class AuditMetadataGenerator {
private static final Logger log = LoggerFactory.getLogger(AuditMetadataGenerator.class);
@@ -354,7 +353,7 @@ public final class AuditMetadataGenerato
ExtendedPropertyMapper propertyMapper = null;
String parentEntityName = null;
- EntityConfiguration entityCfg = new EntityConfiguration(entityName, pc.getClassName(), idMapper, propertyMapper,
+ EntityConfiguration entityCfg = new EntityConfiguration(entityName, idMapper, propertyMapper,
parentEntityName);
notAuditedEntitiesConfigurations.put(entityName, entityCfg);
return;
@@ -428,7 +427,7 @@ public final class AuditMetadataGenerato
addJoins(pc, propertyMapper, auditingData, pc.getEntityName(), xmlMappingData, true);
// Storing the generated configuration
- EntityConfiguration entityCfg = new EntityConfiguration(auditEntityName,pc.getClassName(), idMapper,
+ EntityConfiguration entityCfg = new EntityConfiguration(auditEntityName, idMapper,
propertyMapper, parentEntityName);
entitiesConfigurations.put(pc.getEntityName(), entityCfg);
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/query/AuditQueryCreator.java
@@ -32,7 +32,6 @@ import static org.hibernate.envers.tools
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class AuditQueryCreator {
private final AuditConfiguration auditCfg;
@@ -57,22 +56,6 @@ public class AuditQueryCreator {
checkPositive(revision, "Entity revision");
return new EntitiesAtRevisionQuery(auditCfg, auditReaderImplementor, c, revision);
}
-
- /**
- * Creates a query, which will return entities satisfying some conditions (specified later),
- * at a given revision and a given entityName.
- * @param c Class of the entities for which to query.
- * @param entityName EntityName of the entities for which to query.
- * @param revision Revision number at which to execute the query.
- * @return A query for entities at a given revision, to which conditions can be added and which
- * can then be executed. The result of the query will be a list of entities (beans), unless a
- * projection is added.
- */
- public AuditQuery forEntitiesAtRevision(Class<?> c, String entityName, Number revision) {
- checkNotNull(revision, "Entity revision");
- checkPositive(revision, "Entity revision");
- return new EntitiesAtRevisionQuery(auditCfg, auditReaderImplementor, c, entityName, revision);
- }
/**
* Creates a query, which selects the revisions, at which the given entity was modified.
@@ -97,30 +80,4 @@ public class AuditQueryCreator {
public AuditQuery forRevisionsOfEntity(Class<?> c, boolean selectEntitiesOnly, boolean selectDeletedEntities) {
return new RevisionsOfEntityQuery(auditCfg, auditReaderImplementor, c, selectEntitiesOnly,selectDeletedEntities);
}
-
- /**
- * Creates a query, which selects the revisions, at which the given entity was modified and with a given entityName.
- * Unless an explicit projection is set, the result will be a list of three-element arrays, containing:
- * <ol>
- * <li>the entity instance</li>
- * <li>revision entity, corresponding to the revision at which the entity was modified. If no custom
- * revision entity is used, this will be an instance of {@link org.hibernate.envers.DefaultRevisionEntity}</li>
- * <li>type of the revision (an enum instance of class {@link org.hibernate.envers.RevisionType})</li>.
- * </ol>
- * Additional conditions that the results must satisfy may be specified.
- * @param c Class of the entities for which to query.
- * @param entityName EntityName of the entities for which to query.
- * @param selectEntitiesOnly If true, instead of a list of three-element arrays, a list of entites will be
- * returned as a result of executing this query.
- * @param selectDeletedEntities If true, also revisions where entities were deleted will be returned. The additional
- * entities will have revision type "delete", and contain no data (all fields null), except for the id field.
- * @return A query for revisions at which instances of the given entity were modified, to which
- * conditions can be added (for example - a specific id of an entity of class <code>c</code>), and which
- * can then be executed. The results of the query will be sorted in ascending order by the revision number,
- * unless an order or projection is added.
- */
- public AuditQuery forRevisionsOfEntity(Class<?> c, String entityName, boolean selectEntitiesOnly, boolean selectDeletedEntities) {
- return new RevisionsOfEntityQuery(auditCfg, auditReaderImplementor, c, entityName, selectEntitiesOnly,selectDeletedEntities);
- }
-
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/query/impl/AbstractAuditQuery.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/query/impl/AbstractAuditQuery.java
@@ -50,14 +50,12 @@ import org.hibernate.LockOptions;
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public abstract class AbstractAuditQuery implements AuditQuery {
protected EntityInstantiator entityInstantiator;
protected List<AuditCriterion> criterions;
protected String entityName;
- protected String entityClassName;
protected String versionsEntityName;
protected QueryBuilder qb;
@@ -69,25 +67,18 @@ public abstract class AbstractAuditQuery
protected AbstractAuditQuery(AuditConfiguration verCfg, AuditReaderImplementor versionsReader,
Class<?> cls) {
- this(verCfg, versionsReader, cls, cls.getName());
+ this.verCfg = verCfg;
+ this.versionsReader = versionsReader;
+
+ criterions = new ArrayList<AuditCriterion>();
+ entityInstantiator = new EntityInstantiator(verCfg, versionsReader);
+
+ entityName = cls.getName();
+ versionsEntityName = verCfg.getAuditEntCfg().getAuditEntityName(entityName);
+
+ qb = new QueryBuilder(versionsEntityName, "e");
}
- protected AbstractAuditQuery(AuditConfiguration verCfg,
- AuditReaderImplementor versionsReader, Class<?> cls, String entityName) {
- this.verCfg = verCfg;
- this.versionsReader = versionsReader;
-
- criterions = new ArrayList<AuditCriterion>();
- entityInstantiator = new EntityInstantiator(verCfg, versionsReader);
-
- entityClassName = cls.getName();
- this.entityName = entityName;
- versionsEntityName = verCfg.getAuditEntCfg().getAuditEntityName(
- entityName);
-
- qb = new QueryBuilder(versionsEntityName, "e");
- }
-
protected List buildAndExecuteQuery() {
StringBuilder querySb = new StringBuilder();
Map<String, Object> queryParamValues = new HashMap<String, Object>();
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/query/impl/EntitiesAtRevisionQuery.java
@@ -35,7 +35,6 @@ import org.hibernate.envers.tools.query.
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class EntitiesAtRevisionQuery extends AbstractAuditQuery {
private final Number revision;
@@ -46,12 +45,6 @@ public class EntitiesAtRevisionQuery ext
super(verCfg, versionsReader, cls);
this.revision = revision;
}
-
- public EntitiesAtRevisionQuery(AuditConfiguration verCfg,
- AuditReaderImplementor versionsReader, Class<?> cls, String entityName, Number revision) {
- super(verCfg, versionsReader, cls, entityName);
- this.revision = revision;
- }
@SuppressWarnings({"unchecked"})
public List list() {
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/query/impl/RevisionsOfEntityQuery.java
@@ -33,11 +33,11 @@ import org.hibernate.envers.configuratio
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.query.criteria.AuditCriterion;
import org.hibernate.envers.reader.AuditReaderImplementor;
+
import org.hibernate.proxy.HibernateProxy;
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class RevisionsOfEntityQuery extends AbstractAuditQuery {
private final boolean selectEntitiesOnly;
@@ -53,15 +53,6 @@ public class RevisionsOfEntityQuery exte
this.selectDeletedEntities = selectDeletedEntities;
}
- public RevisionsOfEntityQuery(AuditConfiguration verCfg,
- AuditReaderImplementor versionsReader, Class<?> cls, String entityName,
- boolean selectEntitiesOnly, boolean selectDeletedEntities) {
- super(verCfg, versionsReader, cls, entityName);
-
- this.selectEntitiesOnly = selectEntitiesOnly;
- this.selectDeletedEntities = selectDeletedEntities;
- }
-
private Number getRevisionNumber(Map versionsEntity) {
AuditEntitiesConfiguration verEntCfg = verCfg.getAuditEntCfg();
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/EntityInstantiator.java
@@ -36,7 +36,6 @@ import org.hibernate.util.ReflectHelper;
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class EntityInstantiator {
private final AuditConfiguration verCfg;
@@ -81,13 +80,7 @@ public class EntityInstantiator {
// If it is not in the cache, creating a new entity instance
Object ret;
try {
- EntityConfiguration entCfg = verCfg.getEntCfg().get(entityName);
- if(entCfg == null) {
- // a relation marked as RelationTargetAuditMode.NOT_AUDITED
- entCfg = verCfg.getEntCfg().getNotVersionEntityConfiguration(entityName);
- }
-
- Class<?> cls = ReflectionTools.loadClass(entCfg.getEntityClassName());
+ Class<?> cls = ReflectionTools.loadClass(entityName);
ret = ReflectHelper.getDefaultConstructor(cls).newInstance();
} catch (Exception e) {
throw new AuditException(e);
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/EntityConfiguration.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/EntityConfiguration.java
@@ -32,22 +32,18 @@ import org.hibernate.envers.entities.map
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class EntityConfiguration {
private String versionsEntityName;
- /** Holds the className for instantiation the configured entity */
- private String entityClassName;
- private IdMappingData idMappingData;
+ private IdMappingData idMappingData;
private ExtendedPropertyMapper propertyMapper;
// Maps from property name
private Map<String, RelationDescription> relations;
private String parentEntityName;
- public EntityConfiguration(String versionsEntityName, String entityClassName, IdMappingData idMappingData,
+ public EntityConfiguration(String versionsEntityName, IdMappingData idMappingData,
ExtendedPropertyMapper propertyMapper, String parentEntityName) {
this.versionsEntityName = versionsEntityName;
- this.entityClassName = entityClassName;
this.idMappingData = idMappingData;
this.propertyMapper = propertyMapper;
this.parentEntityName = parentEntityName;
@@ -104,12 +100,12 @@ public class EntityConfiguration {
return propertyMapper;
}
- public String getParentEntityName() {
+ // For use by EntitiesConfigurations
+
+ String getParentEntityName() {
return parentEntityName;
}
- // For use by EntitiesConfigurations
-
String getVersionsEntityName() {
return versionsEntityName;
}
@@ -117,11 +113,4 @@ public class EntityConfiguration {
Iterable<RelationDescription> getRelationsIterator() {
return relations.values();
}
-
- /**
- * @return the className for the configured entity
- */
- public String getEntityClassName() {
- return entityClassName;
- }
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/mapper/ComponentPropertyMapper.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/mapper/ComponentPropertyMapper.java
@@ -24,19 +24,19 @@
package org.hibernate.envers.entities.mapper;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
-import org.hibernate.collection.PersistentCollection;
-import org.hibernate.engine.SessionImplementor;
-import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.PropertyData;
+import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.reflection.ReflectionTools;
+
+import org.hibernate.collection.PersistentCollection;
import org.hibernate.property.Setter;
import org.hibernate.util.ReflectHelper;
+import org.hibernate.engine.SessionImplementor;
/**
* @author Adam Warski (adam at warski dot org)
@@ -84,12 +84,8 @@ public class ComponentPropertyMapper imp
}
}
- if (allNullAndSingle) {
- // single property, but default value need not be null, so we'll set it to null anyway
- setter.set(obj, null, null);
-
- } else {
- // set the component
+ // And we don't have to set anything on the object - the default value is null
+ if (!allNullAndSingle) {
try {
Object subObj = ReflectHelper.getDefaultConstructor(
Thread.currentThread().getContextClassLoader().loadClass(componentClassName)).newInstance();
@@ -101,7 +97,7 @@ public class ComponentPropertyMapper imp
}
}
- public List<PersistentCollectionChangeData> mapCollectionChanges(String referencingPropertyName,
+ public List<PersistentCollectionChangeData> mapCollectionChanges(String referencingPropertyName,
PersistentCollection newColl,
Serializable oldColl,
Serializable id) {
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
@@ -33,7 +33,6 @@ import org.hibernate.envers.entities.map
import org.hibernate.envers.entities.mapper.PropertyMapper;
import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
-import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
@@ -45,7 +44,6 @@ import org.hibernate.engine.SessionImple
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class ToOneIdMapper implements PropertyMapper {
private final IdMapper delegate;
@@ -70,7 +68,7 @@ public class ToOneIdMapper implements Pr
delegate.mapToMapFromEntity(newData, nonInsertableFake ? oldObj : newObj);
//noinspection SimplifiableConditionalExpression
- return nonInsertableFake ? false : !Tools.entitiesEqual(session, referencedEntityName, newObj, oldObj);
+ return nonInsertableFake ? false : !Tools.entitiesEqual(session, newObj, oldObj);
}
public void mapToEntityFromMap(AuditConfiguration verCfg, Object obj, Map data, Object primaryKey,
@@ -87,13 +85,7 @@ public class ToOneIdMapper implements Pr
if (versionsReader.getFirstLevelCache().contains(referencedEntityName, revision, entityId)) {
value = versionsReader.getFirstLevelCache().get(referencedEntityName, revision, entityId);
} else {
- EntityConfiguration entCfg = verCfg.getEntCfg().get(referencedEntityName);
- if(entCfg == null) {
- // a relation marked as RelationTargetAuditMode.NOT_AUDITED
- entCfg = verCfg.getEntCfg().getNotVersionEntityConfiguration(referencedEntityName);
- }
-
- Class<?> entityClass = ReflectionTools.loadClass(entCfg.getEntityClassName());
+ Class<?> entityClass = ReflectionTools.loadClass(referencedEntityName);
value = versionsReader.getSessionImplementor().getFactory().getEntityPersister(referencedEntityName).
createProxy((Serializable)entityId, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/OneToOneNotOwningMapper.java
@@ -31,7 +31,6 @@ import javax.persistence.NoResultExcepti
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
import org.hibernate.envers.entities.mapper.PropertyMapper;
-import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.PropertyData;
import org.hibernate.envers.exception.AuditException;
import org.hibernate.envers.query.AuditEntity;
@@ -45,7 +44,6 @@ import org.hibernate.property.Setter;
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class OneToOneNotOwningMapper implements PropertyMapper {
private String owningReferencePropertyName;
@@ -68,18 +66,12 @@ public class OneToOneNotOwningMapper imp
return;
}
- EntityConfiguration entCfg = verCfg.getEntCfg().get(owningEntityName);
- if(entCfg == null) {
- // a relation marked as RelationTargetAuditMode.NOT_AUDITED
- entCfg = verCfg.getEntCfg().getNotVersionEntityConfiguration(owningEntityName);
- }
-
- Class<?> entityClass = ReflectionTools.loadClass(entCfg.getEntityClassName());
+ Class<?> entityClass = ReflectionTools.loadClass(owningEntityName);
Object value;
try {
- value = versionsReader.createQuery().forEntitiesAtRevision(entityClass, owningEntityName, revision)
+ value = versionsReader.createQuery().forEntitiesAtRevision(entityClass, revision)
.add(AuditEntity.relatedId(owningReferencePropertyName).eq(primaryKey)).getSingleResult();
} catch (NoResultException e) {
value = null;
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
@@ -27,6 +27,7 @@ import java.io.Serializable;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntitiesConfigurations;
+import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.HibernateException;
@@ -34,7 +35,6 @@ import org.hibernate.HibernateException;
/**
* @author Adam Warski (adam at warski dot org)
* @author Tomasz Bech
- * @author Hernn Chanfreau
*/
public class ToOneDelegateSessionImplementor extends AbstractDelegateSessionImplementor {
private static final long serialVersionUID = 4770438372940785488L;
@@ -43,7 +43,7 @@ public class ToOneDelegateSessionImpleme
private final Class<?> entityClass;
private final Object entityId;
private final Number revision;
- private EntitiesConfigurations entCfg;
+ private EntityConfiguration notVersionedEntityConfiguration;
public ToOneDelegateSessionImplementor(AuditReaderImplementor versionsReader,
Class<?> entityClass, Object entityId, Number revision,
@@ -53,15 +53,14 @@ public class ToOneDelegateSessionImpleme
this.entityClass = entityClass;
this.entityId = entityId;
this.revision = revision;
- this.entCfg = verCfg.getEntCfg();
+ EntitiesConfigurations entCfg = verCfg.getEntCfg();
+ notVersionedEntityConfiguration = entCfg.getNotVersionEntityConfiguration(entityClass.getName());
}
public Object doImmediateLoad(String entityName) throws HibernateException {
- if(entCfg.getNotVersionEntityConfiguration(entityName) == null){
- // audited relation, look up entity with envers
- return versionsReader.find(entityClass, entityName, entityId, revision);
+ if (notVersionedEntityConfiguration == null) {
+ return versionsReader.find(entityClass, entityId, revision);
} else {
- // notAudited relation, look up entity with hibernate
return delegate.immediateLoad(entityName, (Serializable) entityId);
}
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/reader/AuditReaderImpl.java
@@ -46,7 +46,7 @@ import org.hibernate.engine.SessionImple
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
+ * @author Hernan Chanfreau
*/
public class AuditReaderImpl implements AuditReaderImplementor {
private final AuditConfiguration verCfg;
@@ -81,22 +81,17 @@ public class AuditReaderImpl implements
return firstLevelCache;
}
- public <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
- IllegalArgumentException, NotAuditedException, IllegalStateException {
-
- return this.find(cls, cls.getName(), primaryKey, revision);
- }
-
@SuppressWarnings({"unchecked"})
- public <T> T find(Class<T> cls, String entityName, Object primaryKey, Number revision) throws
+ public <T> T find(Class<T> cls, Object primaryKey, Number revision) throws
IllegalArgumentException, NotAuditedException, IllegalStateException {
checkNotNull(cls, "Entity class");
- checkNotNull(entityName, "Entity name");
checkNotNull(primaryKey, "Primary key");
checkNotNull(revision, "Entity revision");
checkPositive(revision, "Entity revision");
checkSession();
+ String entityName = cls.getName();
+
if (!verCfg.getEntCfg().isVersioned(entityName)) {
throw new NotAuditedException(entityName, entityName + " is not versioned!");
}
@@ -108,7 +103,7 @@ public class AuditReaderImpl implements
Object result;
try {
// The result is put into the cache by the entity instantiator called from the query
- result = createQuery().forEntitiesAtRevision(cls, entityName, revision)
+ result = createQuery().forEntitiesAtRevision(cls, revision)
.add(AuditEntity.id().eq(primaryKey)).getSingleResult();
} catch (NoResultException e) {
result = null;
@@ -117,28 +112,23 @@ public class AuditReaderImpl implements
}
return (T) result;
- }
-
- public List<Number> getRevisions(Class<?> cls, Object primaryKey)
- throws IllegalArgumentException, NotAuditedException, IllegalStateException {
-
- return this.getRevisions(cls, cls.getName(), primaryKey);
}
@SuppressWarnings({"unchecked"})
- public List<Number> getRevisions(Class<?> cls, String entityName, Object primaryKey)
+ public List<Number> getRevisions(Class<?> cls, Object primaryKey)
throws IllegalArgumentException, NotAuditedException, IllegalStateException {
// todo: if a class is not versioned from the beginning, there's a missing ADD rev - what then?
checkNotNull(cls, "Entity class");
- checkNotNull(entityName, "Entity name");
checkNotNull(primaryKey, "Primary key");
checkSession();
+ String entityName = cls.getName();
+
if (!verCfg.getEntCfg().isVersioned(entityName)) {
throw new NotAuditedException(entityName, entityName + " is not versioned!");
}
- return createQuery().forRevisionsOfEntity(cls, entityName, false, true)
+ return createQuery().forRevisionsOfEntity(cls, false, true)
.addProjection(AuditEntity.revisionNumber())
.add(AuditEntity.id().eq(primaryKey))
.getResultList();
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/synchronization/AuditProcessManager.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/synchronization/AuditProcessManager.java
@@ -52,22 +52,10 @@ public class AuditProcessManager {
AuditProcess auditProcess = auditProcesses.get(transaction);
if (auditProcess == null) {
// No worries about registering a transaction twice - a transaction is single thread
- auditProcess = new AuditProcess(revisionInfoGenerator, session);
+ auditProcess = new AuditProcess(revisionInfoGenerator);
auditProcesses.put(transaction, auditProcess);
- /*
- * HHH-5315: the process must be both a BeforeTransactionCompletionProcess and a TX Synchronization.
- *
- * In a resource-local tx env, the process is called after the flush, and populates the audit tables.
- * Also, any exceptions that occur during that are propagated (if a Synchronization was used, the exceptions
- * would be eaten).
- *
- * In a JTA env, the before transaction completion is called before the flush, so not all changes are yet
- * written. However, Synchronization-s do propagate exceptions, so they can be safely used.
- */
session.getActionQueue().registerProcess(auditProcess);
- session.getTransaction().registerSynchronization(auditProcess);
-
session.getActionQueue().registerProcess(new AfterTransactionCompletionProcess() {
public void doAfterTransactionCompletion(boolean success, SessionImplementor session) {
auditProcesses.remove(transaction);
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/synchronization/AuditProcess.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/synchronization/AuditProcess.java
@@ -37,14 +37,11 @@ import org.hibernate.envers.tools.Pair;
import org.hibernate.FlushMode;
import org.hibernate.Session;
-import javax.transaction.Synchronization;
-
/**
* @author Adam Warski (adam at warski dot org)
*/
-public class AuditProcess implements BeforeTransactionCompletionProcess, Synchronization {
+public class AuditProcess implements BeforeTransactionCompletionProcess {
private final RevisionInfoGenerator revisionInfoGenerator;
- private final SessionImplementor session;
private final LinkedList<AuditWorkUnit> workUnits;
private final Queue<AuditWorkUnit> undoQueue;
@@ -52,9 +49,8 @@ public class AuditProcess implements Bef
private Object revisionData;
- public AuditProcess(RevisionInfoGenerator revisionInfoGenerator, SessionImplementor session) {
+ public AuditProcess(RevisionInfoGenerator revisionInfoGenerator) {
this.revisionInfoGenerator = revisionInfoGenerator;
- this.session = session;
workUnits = new LinkedList<AuditWorkUnit>();
undoQueue = new LinkedList<AuditWorkUnit>();
@@ -157,12 +153,4 @@ public class AuditProcess implements Bef
session.flush();
}
}
-
- // Synchronization methods
-
- public void beforeCompletion() {
- doBeforeTransactionCompletion(session);
- }
-
- public void afterCompletion(int status) { }
}
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/tools/Tools.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/tools/Tools.java
@@ -32,7 +32,6 @@ import java.util.*;
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class Tools {
public static <K,V> Map<K,V> newHashMap() {
@@ -47,14 +46,14 @@ public class Tools {
return new LinkedHashMap<K,V>();
}
- public static boolean entitiesEqual(SessionImplementor session, String entityName, Object obj1, Object obj2) {
- Object id1 = getIdentifier(session, entityName, obj1);
- Object id2 = getIdentifier(session, entityName, obj2);
+ public static boolean entitiesEqual(SessionImplementor session, Object obj1, Object obj2) {
+ Object id1 = getIdentifier(session, obj1);
+ Object id2 = getIdentifier(session, obj2);
return objectsEqual(id1, id2);
- }
+ }
- public static Object getIdentifier(SessionImplementor session, String entityName, Object obj) {
+ public static Object getIdentifier(SessionImplementor session, Object obj) {
if (obj == null) {
return null;
}
@@ -64,9 +63,9 @@ public class Tools {
return hibernateProxy.getHibernateLazyInitializer().getIdentifier();
}
- return session.getEntityPersister(entityName, obj).getIdentifier(obj, session);
- }
+ return session.getEntityPersister( null, obj ).getIdentifier( obj, session );
+ }
public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy) {
if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
--- libhibernate3-java-3.5.4.Final.orig/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
+++ libhibernate3-java-3.5.4.Final/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
@@ -27,7 +27,6 @@ import java.io.Serializable;
import java.util.List;
import org.hibernate.envers.configuration.AuditConfiguration;
-import org.hibernate.envers.entities.EntityConfiguration;
import org.hibernate.envers.entities.RelationDescription;
import org.hibernate.envers.entities.RelationType;
import org.hibernate.envers.entities.mapper.PersistentCollectionChangeData;
@@ -61,7 +60,6 @@ import org.hibernate.proxy.HibernateProx
/**
* @author Adam Warski (adam at warski dot org)
- * @author Hernn Chanfreau
*/
public class AuditEventListener implements PostInsertEventListener, PostUpdateEventListener,
PostDeleteEventListener, PreCollectionUpdateEventListener, PreCollectionRemoveEventListener,
@@ -92,7 +90,7 @@ public class AuditEventListener implemen
Object oldValue = oldState == null ? null : oldState[i];
Object newValue = newState == null ? null : newState[i];
- if (!Tools.entitiesEqual(session, relDesc.getToEntityName(), oldValue, newValue)) {
+ if (!Tools.entitiesEqual(session, oldValue, newValue)) {
// We have to generate changes both in the old collection (size decreses) and new collection
// (size increases).
if (newValue != null) {
@@ -266,7 +264,7 @@ public class AuditEventListener implemen
// Checking if this is not a "fake" many-to-one bidirectional relation. The relation description may be
// null in case of collections of non-entities.
- RelationDescription rd = searchForRelationDescription(entityName, referencingPropertyName);
+ RelationDescription rd = verCfg.getEntCfg().get(entityName).getRelationDescription(referencingPropertyName);
if (rd != null && rd.getMappedByPropertyName() != null) {
generateFakeBidirecationalRelationWorkUnits(auditProcess, newColl, oldColl, entityName,
referencingPropertyName, event, rd);
@@ -287,24 +285,6 @@ public class AuditEventListener implemen
}
}
- /**
- * Looks up a relation description corresponding to the given property in the given entity. If no description is
- * found in the given entity, the parent entity is checked (so that inherited relations work).
- * @param entityName Name of the entity, in which to start looking.
- * @param referencingPropertyName The name of the property.
- * @return A found relation description corresponding to the given entity or {@code null}, if no description can
- * be found.
- */
- private RelationDescription searchForRelationDescription(String entityName, String referencingPropertyName) {
- EntityConfiguration configuration = verCfg.getEntCfg().get(entityName);
- RelationDescription rd = configuration.getRelationDescription(referencingPropertyName);
- if (rd == null && configuration.getParentEntityName() != null) {
- return searchForRelationDescription(configuration.getParentEntityName(), referencingPropertyName);
- }
-
- return rd;
- }
-
private CollectionEntry getCollectionEntry(AbstractCollectionEvent event) {
return event.getSession().getPersistenceContext().getCollectionEntry(event.getCollection());
}
--- libhibernate3-java-3.5.4.Final.orig/cache-oscache/pom.xml
+++ libhibernate3-java-3.5.4.Final/cache-oscache/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/distribution/pom.xml
+++ libhibernate3-java-3.5.4.Final/distribution/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/annotations/pom.xml
+++ libhibernate3-java-3.5.4.Final/annotations/pom.xml
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/quote/resultsetmappings/ExplicitSqlResultSetMappingTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/quote/resultsetmappings/ExplicitSqlResultSetMappingTest.java
@@ -34,7 +34,7 @@ import org.hibernate.test.annotations.Te
* @author Steve Ebersole
*/
public class ExplicitSqlResultSetMappingTest extends TestCase {
- private String queryString = null;
+ private String queryString = "select t.\"NAME\" as \"QuotEd_nAMe\" from \"MY_ENTITY_TABLE\" t";
@Override
protected Class<?>[] getAnnotatedClasses() {
@@ -47,9 +47,6 @@ public class ExplicitSqlResultSetMapping
}
private void prepareTestData() {
- char open = getDialect().openQuote();
- char close = getDialect().closeQuote();
- queryString = "select t."+open+"NAME"+close+" as "+open+"QuotEd_nAMe"+close+" from "+open+"MY_ENTITY_TABLE"+close+" t";
Session s = sfi().openSession();
s.beginTransaction();
s.save( new MyEntity( "mine" ) );
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java
@@ -1,34 +1,10 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
+//$Id: IdTest.java 18704 2010-02-05 18:28:39Z steve.ebersole@jboss.com $
package org.hibernate.test.annotations.id.sequences;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
-import org.hibernate.junit.DialectChecks;
-import org.hibernate.junit.RequiresDialectFeature;
import org.hibernate.mapping.Column;
import org.hibernate.test.annotations.TestCase;
import org.hibernate.test.annotations.id.sequences.entities.Ball;
@@ -53,28 +29,27 @@ import org.hibernate.test.annotations.id
* @author Emmanuel Bernard
*/
@SuppressWarnings("unchecked")
-@RequiresDialectFeature(DialectChecks.SupportsSequences.class)
public class IdTest extends TestCase {
public void testGenericGenerator() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
SoundSystem system = new SoundSystem();
- system.setBrand( "Genelec" );
- system.setModel( "T234" );
+ system.setBrand("Genelec");
+ system.setModel("T234");
Furniture fur = new Furniture();
- s.persist( system );
- s.persist( fur );
+ s.persist(system);
+ s.persist(fur);
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
- system = ( SoundSystem ) s.get( SoundSystem.class, system.getId() );
- fur = ( Furniture ) s.get( Furniture.class, fur.getId() );
- assertNotNull( system );
- assertNotNull( fur );
- s.delete( system );
- s.delete( fur );
+ system = (SoundSystem) s.get(SoundSystem.class, system.getId());
+ fur = (Furniture) s.get(Furniture.class, fur.getId());
+ assertNotNull(system);
+ assertNotNull(fur);
+ s.delete(system);
+ s.delete(fur);
tx.commit();
s.close();
@@ -84,14 +59,13 @@ public class IdTest extends TestCase {
* Ensures that GenericGenerator annotations wrapped inside a
* GenericGenerators holder are bound correctly
*/
-
public void testGenericGenerators() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
Monkey monkey = new Monkey();
- s.persist( monkey );
+ s.persist(monkey);
s.flush();
- assertNotNull( monkey.getId() );
+ assertNotNull(monkey.getId());
tx.rollback();
s.close();
}
@@ -103,23 +77,21 @@ public class IdTest extends TestCase {
Ball b = new Ball();
Dog d = new Dog();
Computer c = new Computer();
- s.persist( b );
- s.persist( d );
- s.persist( c );
+ s.persist(b);
+ s.persist(d);
+ s.persist(c);
tx.commit();
s.close();
- assertEquals( "table id not generated", new Integer( 1 ), b.getId() );
- assertEquals(
- "generator should not be shared", new Integer( 1 ), d
- .getId()
- );
- assertEquals( "default value should work", new Long( 1 ), c.getId() );
+ assertEquals("table id not generated", new Integer(1), b.getId());
+ assertEquals("generator should not be shared", new Integer(1), d
+ .getId());
+ assertEquals("default value should work", new Long(1), c.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Ball.class, new Integer( 1 ) ) );
- s.delete( s.get( Dog.class, new Integer( 1 ) ) );
- s.delete( s.get( Computer.class, new Long( 1 ) ) );
+ s.delete(s.get(Ball.class, new Integer(1)));
+ s.delete(s.get(Dog.class, new Integer(1)));
+ s.delete(s.get(Computer.class, new Long(1)));
tx.commit();
s.close();
}
@@ -128,14 +100,14 @@ public class IdTest extends TestCase {
Session s = openSession();
Transaction tx = s.beginTransaction();
Shoe b = new Shoe();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Shoe.class, b.getId() ) );
+ s.delete(s.get(Shoe.class, b.getId()));
tx.commit();
s.close();
}
@@ -144,14 +116,14 @@ public class IdTest extends TestCase {
Session s = openSession();
Transaction tx = s.beginTransaction();
Store b = new Store();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Store.class, b.getId() ) );
+ s.delete(s.get(Store.class, b.getId()));
tx.commit();
s.close();
}
@@ -160,14 +132,14 @@ public class IdTest extends TestCase {
Session s = openSession();
Transaction tx = s.beginTransaction();
Department b = new Department();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Department.class, b.getId() ) );
+ s.delete(s.get(Department.class, b.getId()));
tx.commit();
s.close();
}
@@ -178,16 +150,16 @@ public class IdTest extends TestCase {
s = openSession();
tx = s.beginTransaction();
Home h = new Home();
- s.persist( h );
+ s.persist(h);
tx.commit();
s.close();
- assertNotNull( h.getId() );
+ assertNotNull(h.getId());
s = openSession();
tx = s.beginTransaction();
- Home reloadedHome = ( Home ) s.get( Home.class, h.getId() );
- assertEquals( h.getId(), reloadedHome.getId() );
- s.delete( reloadedHome );
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
tx.commit();
s.close();
}
@@ -198,16 +170,16 @@ public class IdTest extends TestCase {
s = openSession();
tx = s.beginTransaction();
Home h = new Home();
- s.persist( h );
+ s.persist(h);
tx.commit();
s.close();
- assertNotNull( h.getId() );
+ assertNotNull(h.getId());
s = openSession();
tx = s.beginTransaction();
- Home reloadedHome = ( Home ) s.get( Home.class, h.getId() );
- assertEquals( h.getId(), reloadedHome.getId() );
- s.delete( reloadedHome );
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
tx.commit();
s.close();
}
@@ -218,13 +190,13 @@ public class IdTest extends TestCase {
s = openSession();
tx = s.beginTransaction();
FirTree chrismasTree = new FirTree();
- s.persist( chrismasTree );
+ s.persist(chrismasTree);
tx.commit();
s.clear();
tx = s.beginTransaction();
- chrismasTree = ( FirTree ) s.get( FirTree.class, chrismasTree.getId() );
- assertNotNull( chrismasTree );
- s.delete( chrismasTree );
+ chrismasTree = (FirTree) s.get(FirTree.class, chrismasTree.getId());
+ assertNotNull(chrismasTree);
+ s.delete(chrismasTree);
tx.commit();
s.close();
}
@@ -234,58 +206,55 @@ public class IdTest extends TestCase {
Transaction tx;
s = openSession();
tx = s.beginTransaction();
- Footballer fb = new Footballer( "David", "Beckam", "Arsenal" );
- GoalKeeper keeper = new GoalKeeper( "Fabien", "Bartez", "OM" );
- s.persist( fb );
- s.persist( keeper );
+ Footballer fb = new Footballer("David", "Beckam", "Arsenal");
+ GoalKeeper keeper = new GoalKeeper("Fabien", "Bartez", "OM");
+ s.persist(fb);
+ s.persist(keeper);
tx.commit();
s.clear();
// lookup by id
tx = s.beginTransaction();
- FootballerPk fpk = new FootballerPk( "David", "Beckam" );
- fb = ( Footballer ) s.get( Footballer.class, fpk );
- FootballerPk fpk2 = new FootballerPk( "Fabien", "Bartez" );
- keeper = ( GoalKeeper ) s.get( GoalKeeper.class, fpk2 );
- assertNotNull( fb );
- assertNotNull( keeper );
- assertEquals( "Beckam", fb.getLastname() );
- assertEquals( "Arsenal", fb.getClub() );
- assertEquals(
- 1, s.createQuery(
- "from Footballer f where f.firstname = 'David'"
- ).list().size()
- );
+ FootballerPk fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ FootballerPk fpk2 = new FootballerPk("Fabien", "Bartez");
+ keeper = (GoalKeeper) s.get(GoalKeeper.class, fpk2);
+ assertNotNull(fb);
+ assertNotNull(keeper);
+ assertEquals("Beckam", fb.getLastname());
+ assertEquals("Arsenal", fb.getClub());
+ assertEquals(1, s.createQuery(
+ "from Footballer f where f.firstname = 'David'").list().size());
tx.commit();
// reattach by merge
tx = s.beginTransaction();
- fb.setClub( "Bimbo FC" );
- s.merge( fb );
+ fb.setClub("Bimbo FC");
+ s.merge(fb);
tx.commit();
// reattach by saveOrUpdate
tx = s.beginTransaction();
- fb.setClub( "Bimbo FC SA" );
- s.saveOrUpdate( fb );
+ fb.setClub("Bimbo FC SA");
+ s.saveOrUpdate(fb);
tx.commit();
// clean up
s.clear();
tx = s.beginTransaction();
- fpk = new FootballerPk( "David", "Beckam" );
- fb = ( Footballer ) s.get( Footballer.class, fpk );
- assertEquals( "Bimbo FC SA", fb.getClub() );
- s.delete( fb );
- s.delete( keeper );
+ fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ assertEquals("Bimbo FC SA", fb.getClub());
+ s.delete(fb);
+ s.delete(keeper);
tx.commit();
s.close();
}
public void testColumnDefinition() {
- Column idCol = ( Column ) getCfg().getClassMapping( Ball.class.getName() )
+ Column idCol = (Column) getCfg().getClassMapping(Ball.class.getName())
.getIdentifierProperty().getValue().getColumnIterator().next();
- assertEquals( "ball_id", idCol.getName() );
+ assertEquals("ball_id", idCol.getName());
}
public void testLowAllocationSize() throws Exception {
@@ -295,39 +264,42 @@ public class IdTest extends TestCase {
tx = s.beginTransaction();
int size = 4;
BreakDance[] bds = new BreakDance[size];
- for ( int i = 0; i < size; i++ ) {
+ for (int i = 0; i < size; i++) {
bds[i] = new BreakDance();
- s.persist( bds[i] );
+ s.persist(bds[i]);
}
s.flush();
- for ( int i = 0; i < size; i++ ) {
- assertEquals( i + 1, bds[i].id.intValue() );
+ for (int i = 0; i < size; i++) {
+ assertEquals(i + 1, bds[i].id.intValue());
}
tx.rollback();
s.close();
}
+
+
+
+ @Override
+ protected boolean runForCurrentDialect() {
+ return super.runForCurrentDialect() && getDialect().supportsSequences();
+ }
/**
* @see org.hibernate.test.annotations.TestCase#getAnnotatedClasses()
*/
protected Class[] getAnnotatedClasses() {
- return new Class[] {
- Ball.class, Shoe.class, Store.class,
+ return new Class[] { Ball.class, Shoe.class, Store.class,
Department.class, Dog.class, Computer.class, Home.class,
Phone.class, Tree.class, FirTree.class, Footballer.class,
SoundSystem.class, Furniture.class, GoalKeeper.class,
- BreakDance.class, Monkey.class
- };
+ BreakDance.class, Monkey.class};
}
-
+
/**
* @see org.hibernate.test.annotations.TestCase#getAnnotatedPackages()
*/
protected String[] getAnnotatedPackages() {
- return new String[] {
- "org.hibernate.test.annotations",
- "org.hibernate.test.annotations.id"
- };
+ return new String[] { "org.hibernate.test.annotations",
+ "org.hibernate.test.annotations.id" };
}
@Override
@@ -339,4 +311,5 @@ public class IdTest extends TestCase {
protected void configure(Configuration cfg) {
cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
}
+
}
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
@@ -1,5 +1,5 @@
-//$Id: ManyToManyTest.java 19744 2010-06-15 20:50:02Z gbadner $
-//$Id: ManyToManyTest.java 19744 2010-06-15 20:50:02Z gbadner $
+//$Id: ManyToManyTest.java 19311 2010-04-27 23:55:49Z gbadner $
+//$Id: ManyToManyTest.java 19311 2010-04-27 23:55:49Z gbadner $
package org.hibernate.test.annotations.manytomany;
@@ -99,11 +99,9 @@ public class ManyToManyTest extends Test
s.close();
s = openSession();
- tx = s.beginTransaction();
List result = s.createCriteria( Supplier.class ).createAlias( "suppStores", "s" ).add(
Restrictions.eq( "s.name", "Fnac" ) ).list();
assertEquals( 1, result.size() );
- tx.commit();
s.close();
}
public void testDefaultCompositePk() throws Exception {
@@ -773,4 +771,4 @@ public class ManyToManyTest extends Test
};
}
-}
+}
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/inheritance/joined/JoinedSubclassTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/inheritance/joined/JoinedSubclassTest.java
@@ -1,9 +1,7 @@
-//$Id: JoinedSubclassTest.java 19907 2010-07-07 13:39:12Z sharathjreddy $
+//$Id: JoinedSubclassTest.java 18602 2010-01-21 20:48:59Z hardy.ferentschik $
package org.hibernate.test.annotations.inheritance.joined;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.hibernate.Session;
import org.hibernate.Transaction;
@@ -124,80 +122,6 @@ public class JoinedSubclassTest extends
transaction.commit();
session.close();
}
-
- //HHH-4250 : @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
- public void testManyToOneWithJoinTable() {
-
- Session s = openSession();
- Transaction tx = s.beginTransaction();
-
- Client c1 = new Client();
- c1.setFirstname("Firstname1");
- c1.setName("Name1");
- c1.setCode("1234");
- c1.setStreet("Street1");
- c1.setCity("City1");
-
- Account a1 = new Account();
- a1.setNumber("1000");
- a1.setBalance(5000.0);
-
- a1.addClient(c1);
-
- s.persist(c1);
- s.persist(a1);
-
- s.flush();
- s.clear();
-
- c1 = (Client) s.load(Client.class, c1.getId());
- assertEquals(5000.0, c1.getAccount().getBalance());
-
- s.flush();
- s.clear();
-
- a1 = (Account) s.load(Account.class,a1.getId());
- Set<Client> clients = a1.getClients();
- assertEquals(1, clients.size());
- Iterator<Client> it = clients.iterator();
- c1 = it.next();
- assertEquals("Name1", c1.getName());
-
- tx.rollback();
- s.close();
- }
-
- /**
- * HHH-4240 - SecondaryTables not recognized when using JOINED inheritance
- */
- public void testSecondaryTables() {
-
- Session s = openSession();
- s.getTransaction().begin();
-
- Company company = new Company();
- company.setCustomerName("Mama");
- company.setCustomerCode("123");
- company.setCompanyName("Mama Mia Pizza");
- company.setCompanyAddress("Rome");
-
- s.persist( company );
- s.getTransaction().commit();
- s.clear();
-
- s = openSession();
- s.getTransaction().begin();
- company = (Company) s.get( Company.class, company.getId());
- assertEquals("Mama", company.getCustomerName());
- assertEquals("123", company.getCustomerCode());
- assertEquals("Mama Mia Pizza", company.getCompanyName());
- assertEquals("Rome", company.getCompanyAddress());
-
- s.delete( company );
- s.getTransaction().commit();
- s.close();
- }
-
// public void testManyToOneAndJoin() throws Exception {
// Session session = openSession();
@@ -244,10 +168,6 @@ public class JoinedSubclassTest extends
Sweater.class,
EventInformation.class,
Alarm.class,
- Client.class,
- Account.class,
- Customer.class,
- Company.class
//Asset.class,
//Parent.class,
//PropertyAsset.class,
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/lob/LobTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/lob/LobTest.java
@@ -1,38 +1,14 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
+//$Id: LobTest.java 18602 2010-01-21 20:48:59Z hardy.ferentschik $
package org.hibernate.test.annotations.lob;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.hibernate.junit.DialectChecks;
-import org.hibernate.junit.RequiresDialectFeature;
+import org.hibernate.dialect.Dialect;
import org.hibernate.test.annotations.TestCase;
/**
* @author Emmanuel Bernard
*/
-@RequiresDialectFeature(DialectChecks.SupportsExpectedLobUsagePattern.class)
public class LobTest extends TestCase {
public void testSerializableToBlob() throws Exception {
Book book = new Book();
@@ -142,6 +118,11 @@ public class LobTest extends TestCase {
super( x );
}
+ @Override
+ protected boolean runForCurrentDialect() {
+ return super.runForCurrentDialect() && getDialect().supportsExpectedLobUsagePattern();
+ }
+
protected Class[] getAnnotatedClasses() {
return new Class[] {
Book.class,
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java
@@ -1,31 +1,7 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
+//$Id:HbmTest.java 9793 2006-04-26 02:20:18 -0400 (mer., 26 avr. 2006) epbernard $
package org.hibernate.test.annotations.xml.hbm;
import org.hibernate.Session;
-import org.hibernate.junit.DialectChecks;
-import org.hibernate.junit.RequiresDialectFeature;
import org.hibernate.test.annotations.TestCase;
/**
@@ -33,7 +9,6 @@ import org.hibernate.test.annotations.Te
*/
public class HbmWithIdentityTest extends TestCase {
- @RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
public void testManyToOneAndInterface() throws Exception {
Session s = openSession();
s.getTransaction().begin();
@@ -48,6 +23,11 @@ public class HbmWithIdentityTest extends
s.close();
}
+ @Override
+ protected boolean runForCurrentDialect() {
+ return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
+ }
+
protected Class[] getAnnotatedClasses() {
return new Class[] {
Sky.class,
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/onetomany/Trainer.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/onetomany/Trainer.java
@@ -1,4 +1,4 @@
-//$Id: Trainer.java 19767 2010-06-18 16:50:20Z epbernard $
+//$Id: Trainer.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $
package org.hibernate.test.annotations.onetomany;
import java.util.Set;
@@ -53,8 +53,7 @@ public class Trainer {
@OneToMany
@JoinTable(
name = "TrainedMonkeys",
- //columns are optional, here we explicit them
- joinColumns = @JoinColumn(name = "trainer_id"),
+ joinColumns = {@JoinColumn(name = "trainer_id")},
inverseJoinColumns = @JoinColumn(name = "monkey_id")
)
@ForeignKey(name = "TM_TRA_FK", inverseName = "TM_MON_FK")
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java
@@ -1,4 +1,4 @@
-//$Id: OneToManyTest.java 19767 2010-06-18 16:50:20Z epbernard $
+//$Id: OneToManyTest.java 18869 2010-02-24 17:11:05Z hardy.ferentschik $
package org.hibernate.test.annotations.onetomany;
import java.util.ArrayList;
@@ -6,7 +6,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -173,28 +172,7 @@ public class OneToManyTest extends TestC
assertNotNull( trainer );
assertNotNull( trainer.getTrainedMonkeys() );
assertEquals( 2, trainer.getTrainedMonkeys().size() );
-
- //test suppression of trainer wo monkey
- final Set<Monkey> monkeySet = new HashSet( trainer.getTrainedMonkeys() );
- s.delete( trainer );
- s.flush();
- tx.commit();
-
- s.clear();
-
- tx = s.beginTransaction();
- for ( Monkey m : monkeySet ) {
- final Object managedMonkey = s.get( Monkey.class, m.getId() );
- assertNotNull( "No trainers but monkeys should still be here", managedMonkey );
- }
-
- //clean up
- for ( Monkey m : monkeySet ) {
- final Object managedMonkey = s.get( Monkey.class, m.getId() );
- s.delete(managedMonkey);
- }
- s.flush();
- tx.commit();
+ tx.rollback();
s.close();
}
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/subselect/SubselectTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/subselect/SubselectTest.java
@@ -71,7 +71,7 @@ public class SubselectTest extends TestC
HighestBid highestBid = (HighestBid) query.list().iterator().next();
assertEquals(200.0, highestBid.getAmount());
- s.getTransaction().rollback();
+
s.close();
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/backquotes/BackquoteTest.java
@@ -1,4 +1,4 @@
-//$Id: BackquoteTest.java 19883 2010-07-01 11:26:39Z sharathjreddy $
+//$Id: BackquoteTest.java 14747 2008-06-06 08:16:25Z hardy.ferentschik $
package org.hibernate.test.annotations.backquotes;
import java.io.PrintWriter;
@@ -6,7 +6,6 @@ import java.io.StringWriter;
import junit.framework.TestCase;
-import org.hibernate.MappingException;
import org.hibernate.cfg.AnnotationConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,33 +34,4 @@ public class BackquoteTest extends TestC
fail(e.getMessage());
}
}
-
- /**
- * HHH-4647 : Problems with @JoinColumn referencedColumnName and quoted column and table names
- *
- * An invalid referencedColumnName to an entity having a quoted table name results in an
- * infinite loop in o.h.c.Configuration$MappingsImpl#getPhysicalColumnName().
- * The same issue exists with getLogicalColumnName()
- */
- public void testInvalidReferenceToQuotedTableName() {
- try {
- AnnotationConfiguration config = new AnnotationConfiguration();
- config.addAnnotatedClass(Printer.class);
- config.addAnnotatedClass(PrinterCable.class);
- config.buildSessionFactory();
- fail("expected MappingException to be thrown");
- }
- //we WANT MappingException to be thrown
- catch( MappingException e ) {
- assertTrue("MappingException was thrown", true);
- }
- catch(Exception e) {
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- log.debug(writer.toString());
- fail(e.getMessage());
- }
- }
-
-
}
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/IntermediateMappedSuperclassTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/mappedsuperclass/intermediate/IntermediateMappedSuperclassTest.java
@@ -40,7 +40,7 @@ public class IntermediateMappedSuperclas
}
public void testGetOnIntermediateMappedSuperclass() {
- final BigDecimal withdrawalLimit = new BigDecimal( 1000 ).setScale( 2 );
+ final BigDecimal withdrawalLimit = new BigDecimal( 1000 );
Session session = openSession();
session.beginTransaction();
SavingsAccount savingsAccount = new SavingsAccount( "123", withdrawalLimit );
@@ -50,8 +50,8 @@ public class IntermediateMappedSuperclas
session = openSession();
session.beginTransaction();
- Account account = ( Account ) session.get( Account.class, savingsAccount.getId() );
- assertEquals( withdrawalLimit, ( ( SavingsAccount ) account ).getWithdrawalLimit() );
+ Account account = (Account) session.get( Account.class, savingsAccount.getId() );
+ assertEquals( withdrawalLimit, ( (SavingsAccount) account ).getWithdrawalLimit() );
session.delete( account );
session.getTransaction().commit();
session.close();
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Tv.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Tv.java
@@ -1,22 +1,19 @@
package org.hibernate.test.annotations.beanvalidation;
-import java.math.BigDecimal;
import java.math.BigInteger;
+import java.math.BigDecimal;
import java.util.Date;
-import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
-import javax.validation.Valid;
+import javax.persistence.Embeddable;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
-
-import org.hibernate.validator.constraints.Length;
+import javax.validation.constraints.NotNull;
+import javax.validation.Valid;
/**
* @author Emmanuel Bernard
- * @author Hardy Ferentschik
*/
@Entity
public class Tv {
@@ -24,28 +21,17 @@ public class Tv {
@Id
@Size(max = 2)
public String serial;
-
- @Length(max=5)
- public String model;
-
public int size;
-
@Size(max = 2)
public String name;
-
@Future
public Date expDate;
-
@Size(min = 0)
public String description;
-
@Min(1000)
public BigInteger lifetime;
-
- @NotNull
- @Valid
+ @NotNull @Valid
public Tuner tuner;
-
@Valid
public Recorder recorder;
@@ -60,4 +46,5 @@ public class Tv {
@NotNull
public BigDecimal time;
}
+
}
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/DDLTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/DDLTest.java
@@ -6,15 +6,13 @@ import org.hibernate.mapping.Property;
import org.hibernate.test.annotations.TestCase;
/**
- * Test verifying that DDL constraints get applied when Bean Validation / Hibernate Validator are enabled.
- *
* @author Emmanuel Bernard
- * @author Hardy Ferentschik
*/
public class DDLTest extends TestCase {
public void testBasicDDL() {
PersistentClass classMapping = getCfg().getClassMapping( Address.class.getName() );
+ //new ClassValidator( Address.class, ResourceBundle.getBundle("messages", Locale.ENGLISH) ).apply( classMapping );
Column stateColumn = (Column) classMapping.getProperty( "state" ).getColumnIterator().next();
assertEquals( stateColumn.getLength(), 3 );
Column zipColumn = (Column) classMapping.getProperty( "zip" ).getColumnIterator().next();
@@ -25,20 +23,9 @@ public class DDLTest extends TestCase {
public void testApplyOnIdColumn() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Tv.class.getName() );
Column serialColumn = (Column) classMapping.getIdentifierProperty().getColumnIterator().next();
- assertEquals( "Validator annotation not applied on ids", 2, serialColumn.getLength() );
+ assertEquals( "Vaidator annotation not applied on ids", 2, serialColumn.getLength() );
}
- /**
- * HHH-5281
- *
- * @throws Exception in case the test fails
- */
- public void testLengthConstraint() throws Exception {
- PersistentClass classMapping = getCfg().getClassMapping( Tv.class.getName() );
- Column modelColumn = (Column) classMapping.getProperty( "model" ).getColumnIterator().next();
- assertEquals( modelColumn.getLength(), 5 );
- }
-
public void testApplyOnManyToOne() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( TvOwner.class.getName() );
Column serialColumn = (Column) classMapping.getProperty( "tv" ).getColumnIterator().next();
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java
@@ -3,10 +3,8 @@ package org.hibernate.test.annotations.b
import java.math.BigDecimal;
import javax.validation.ConstraintViolationException;
-import org.hibernate.mapping.PersistentClass;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.hibernate.mapping.Column;
import org.hibernate.cfg.Configuration;
import org.hibernate.test.annotations.TestCase;
@@ -29,12 +27,6 @@ public class BeanValidationDisabledTest
tx.rollback();
s.close();
}
-
- public void testDDLDisabled() {
- PersistentClass classMapping = getCfg().getClassMapping( Address.class.getName() );
- Column countryColumn = (Column) classMapping.getProperty( "country" ).getColumnIterator().next();
- assertTrue("DDL constraints are applied", countryColumn.isNullable() );
- }
@Override
protected void configure(Configuration cfg) {
@@ -44,8 +36,7 @@ public class BeanValidationDisabledTest
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {
- Address.class,
CupHolder.class
};
}
-}
+}
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/manytoone/referencedcolumnname/ManyToOneReferencedColumnNameTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/manytoone/referencedcolumnname/ManyToOneReferencedColumnNameTest.java
@@ -1,54 +1,29 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
+//$
package org.hibernate.test.annotations.manytoone.referencedcolumnname;
import java.math.BigDecimal;
-import org.hibernate.Session;
-import org.hibernate.junit.DialectChecks;
-import org.hibernate.junit.RequiresDialectFeature;
import org.hibernate.test.annotations.TestCase;
+import org.hibernate.Session;
/**
* @author Emmanuel Bernard
*/
public class ManyToOneReferencedColumnNameTest extends TestCase {
- @RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
public void testReoverableExceptionInFkOrdering() throws Exception {
//SF should not blow up
Vendor v = new Vendor();
Item i = new Item();
ZItemCost ic = new ZItemCost();
- ic.setCost( new BigDecimal( 2 ) );
+ ic.setCost( new BigDecimal(2) );
ic.setItem( i );
ic.setVendor( v );
WarehouseItem wi = new WarehouseItem();
wi.setDefaultCost( ic );
wi.setItem( i );
wi.setVendor( v );
- wi.setQtyInStock( new BigDecimal( 2 ) );
- Session s = openSession();
+ wi.setQtyInStock( new BigDecimal(2) );
+ Session s = openSession( );
s.getTransaction().begin();
s.save( i );
s.save( v );
@@ -57,7 +32,15 @@ public class ManyToOneReferencedColumnNa
s.flush();
s.getTransaction().rollback();
s.close();
+
}
+
+ @Override
+ protected boolean runForCurrentDialect() {
+ return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
+ }
+
+
protected Class[] getAnnotatedClasses() {
return new Class[] {
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneTest.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/onetoone/OneToOneTest.java
@@ -1,9 +1,8 @@
-//$Id: OneToOneTest.java 19881 2010-07-01 11:09:45Z sharathjreddy $
+//$Id: OneToOneTest.java 18870 2010-02-24 18:45:11Z hardy.ferentschik $
package org.hibernate.test.annotations.onetoone;
import java.util.Iterator;
-import org.hibernate.EmptyInterceptor;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
@@ -176,6 +175,7 @@ public class OneToOneTest extends TestCa
party.partyAffiliate = affiliate;
affiliate.party = party;
s.persist( party );
+ s.persist( affiliate );
s.getTransaction().commit();
s.clear();
@@ -270,40 +270,6 @@ public class OneToOneTest extends TestCa
"The mapping defines join columns which could not be found in the metadata.", fooFound && barFound
);
}
-
- /**
- * HHH-5109 @OneToOne - too many joins
- * This test uses an interceptor to verify that correct number of joins
- * are generated.
- */
- public void testPkOneToOneSelectStatementDoesNotGenerateExtraJoin() {
-
- Session s = openSession(new JoinCounter(1));
- Transaction tx = s.beginTransaction();
- Owner owner = new Owner();
- OwnerAddress address = new OwnerAddress();
- owner.setAddress( address );
- address.setOwner( owner );
- s.persist( owner );
- s.flush();
- s.clear();
-
- owner = ( Owner ) s.get( Owner.class, owner.getId() );
- assertNotNull( owner );
- assertNotNull( owner.getAddress() );
- assertEquals( owner.getId(), owner.getAddress().getId() );
- s.flush();
- s.clear();
-
- address = ( OwnerAddress ) s.get( OwnerAddress.class, address.getId() );
- assertNotNull( address );
- assertNotNull( address.getOwner() );
- assertEquals( address.getId(), address.getOwner().getId() );
-
- tx.rollback();
- s.close();
- }
-
/**
* @see org.hibernate.test.annotations.TestCase#getAnnotatedClasses()
@@ -333,55 +299,3 @@ public class OneToOneTest extends TestCa
return new String[] { "org/hibernate/test/annotations/onetoone/orm.xml" };
}
}
-
-
-/**
- * Verifies that generated 'select' statement has desired number of joins
- * @author Sharath Reddy
- *
- */
-class JoinCounter extends EmptyInterceptor {
-
- private static final long serialVersionUID = -3689681272273261051L;
-
- private int expectedNumberOfJoins = 0;
-
- public JoinCounter(int val) {
- super();
- this.expectedNumberOfJoins = val;
- }
-
- public String onPrepareStatement(String sql) {
-
- int numberOfJoins = 0;
- if (sql.startsWith("select")) {
- numberOfJoins = count(sql, "join");
- TestCase.assertEquals(expectedNumberOfJoins, numberOfJoins);
- }
-
- return sql;
- }
-
- /**
- * Count the number of instances of substring within a string.
- *
- * @param string String to look for substring in.
- * @param substring Sub-string to look for.
- * @return Count of substrings in string.
- */
- private int count(final String string, final String substring)
- {
- int count = 0;
- int idx = 0;
-
- while ((idx = string.indexOf(substring, idx)) != -1)
- {
- idx++;
- count++;
- }
-
- return count;
- }
-
-}
-
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/onetoone/Party.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/onetoone/Party.java
@@ -1,7 +1,6 @@
-//$Id: Party.java 19881 2010-07-01 11:09:45Z sharathjreddy $
+//$Id: Party.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $
package org.hibernate.test.annotations.onetoone;
-import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
@@ -15,7 +14,7 @@ public class Party {
@Id
String partyId;
- @OneToOne(cascade=CascadeType.ALL)
+ @OneToOne
@PrimaryKeyJoinColumn
PartyAffiliate partyAffiliate;
}
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/test/java/org/hibernate/test/annotations/onetoone/OwnerAddress.java
@@ -1,4 +1,4 @@
-//$Id: OwnerAddress.java 19881 2010-07-01 11:09:45Z sharathjreddy $
+//$Id: OwnerAddress.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $
package org.hibernate.test.annotations.onetoone;
import javax.persistence.Entity;
@@ -18,7 +18,7 @@ public class OwnerAddress {
@GenericGenerator(strategy = "foreign", name = "fk", parameters = @Parameter(name="property", value="owner"))
private Integer id;
- @OneToOne(mappedBy="address")
+ @OneToOne(mappedBy="address", optional = false)
private Owner owner;
public Integer getId() {
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/main/java/org/hibernate/annotations/PolymorphismType.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/main/java/org/hibernate/annotations/PolymorphismType.java
@@ -24,7 +24,7 @@
package org.hibernate.annotations;
/**
- * Type of available polymorphism for a particular entity
+ * Type of avaliable polymorphism for a particular entity
*
* @author Emmanuel Bernard
*/
@@ -34,7 +34,7 @@ public enum PolymorphismType {
*/
IMPLICIT,
/**
- * this entity is retrieved only if explicitly asked
+ * this entity is retrived only if explicitly asked
*/
EXPLICIT
}
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
@@ -1,4 +1,4 @@
-// $Id: AnnotationBinder.java 19881 2010-07-01 11:09:45Z sharathjreddy $
+// $Id: AnnotationBinder.java 19241 2010-04-16 10:11:32Z epbernard $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@@ -1563,9 +1563,7 @@ public final class AnnotationBinder {
}
}
//MapsId means the columns belong to the pk => not null
- //@PKJC must be constrained
- final boolean mandatory = !ann.optional() || forcePersist || trueOneToOne;
-
+ final boolean mandatory = !ann.optional() || forcePersist;
bindOneToOne(
getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist ),
joinColumns,
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java
@@ -50,7 +50,7 @@ public class BeanValidationActivator {
properties.setProperty( Environment.CHECK_NULLABILITY, "false" );
}
- if ( ! ( modes.contains( ValidationMode.CALLBACK ) || modes.contains( ValidationMode.AUTO ) ) ) return;
+ if ( modes.contains( ValidationMode.NONE ) ) return;
try {
Class<?> activator = ReflectHelper.classForName( TYPE_SAFE_ACTIVATOR_CLASS, BeanValidationActivator.class );
--- libhibernate3-java-3.5.4.Final.orig/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
+++ libhibernate3-java-3.5.4.Final/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
@@ -39,7 +39,6 @@ import org.hibernate.util.ReflectHelper;
/**
* @author Emmanuel Bernard
- * @author Hardy Ferentschik
*/
class TypeSafeActivator {
@@ -149,17 +148,12 @@ class TypeSafeActivator {
if ( canApplyNotNull ) {
hasNotNull = hasNotNull || applyNotNull( property, descriptor );
}
-
- // apply bean validation specific constraints
applyDigits( property, descriptor );
applySize( property, descriptor, propertyDesc );
applyMin( property, descriptor );
applyMax( property, descriptor );
- // apply hibernate validator specific constraints - we cannot import any HV specific classes though!
- applyLength( property, descriptor, propertyDesc );
-
- // pass an empty set as composing constraints inherit the main constraint and thus are matching already
+ //pass an empty set as composing constraints inherit the main constraint and thus are matching already
hasNotNull = hasNotNull || applyConstraints(
descriptor.getComposingConstraints(),
property, propertyDesc, null,
@@ -219,28 +213,14 @@ class TypeSafeActivator {
}
}
- private static void applySize(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
+ private static void applySize(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDesc) {
if ( Size.class.equals( descriptor.getAnnotation().annotationType() )
- && String.class.equals( propertyDescriptor.getElementClass() ) ) {
- @SuppressWarnings("unchecked")
- ConstraintDescriptor<Size> sizeConstraint = ( ConstraintDescriptor<Size> ) descriptor;
+ && String.class.equals( propertyDesc.getElementClass() ) ) {
+ @SuppressWarnings( "unchecked" )
+ ConstraintDescriptor<Size> sizeConstraint = (ConstraintDescriptor<Size>) descriptor;
int max = sizeConstraint.getAnnotation().max();
- Column col = ( Column ) property.getColumnIterator().next();
- if ( max < Integer.MAX_VALUE ) {
- col.setLength( max );
- }
- }
- }
-
- private static void applyLength(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
- if ( "org.hibernate.validator.constraints.Length".equals(descriptor.getAnnotation().annotationType().getName())
- && String.class.equals( propertyDescriptor.getElementClass() ) ) {
- @SuppressWarnings("unchecked")
- int max = (Integer) descriptor.getAttributes().get( "max" );
- Column col = ( Column ) property.getColumnIterator().next();
- if ( max < Integer.MAX_VALUE ) {
- col.setLength( max );
- }
+ Column col = (Column) property.getColumnIterator().next();
+ if ( max < Integer.MAX_VALUE ) col.setLength( max );
}
}
--- libhibernate3-java-3.5.4.Final.orig/cache-ehcache/pom.xml
+++ libhibernate3-java-3.5.4.Final/cache-ehcache/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/testsuite/pom.xml
+++ libhibernate3-java-3.5.4.Final/testsuite/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.2-Final</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/batch/DataPoint.hbm.xml
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/batch/DataPoint.hbm.xml
@@ -13,10 +13,10 @@
<generator class="increment"/>
</id>
<property name="x">
- <column name="xval" not-null="true" precision="25" scale="20" unique-key="xy"/>
+ <column name="xval" not-null="true" length="4" unique-key="xy"/>
</property>
<property name="y">
- <column name="yval" not-null="true" precision="25" scale="20" unique-key="xy"/>
+ <column name="yval" not-null="true" length="4" unique-key="xy"/>
</property>
<property name="description"/>
</class>
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/sql/hand/quotedidentifiers/NativeSqlAndQuotedIdentifiersTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/sql/hand/quotedidentifiers/NativeSqlAndQuotedIdentifiersTest.java
@@ -49,7 +49,6 @@ public class NativeSqlAndQuotedIdentifie
@Override
protected void prepareTest() throws Exception {
- if(sfi() == null) return;
Session session = sfi().openSession();
session.beginTransaction();
session.save( new Person( "me" ) );
@@ -59,7 +58,6 @@ public class NativeSqlAndQuotedIdentifie
@Override
protected void cleanupTest() throws Exception {
- if(sfi() == null) return;
Session session = sfi().openSession();
session.beginTransaction();
session.createQuery( "delete Person" ).executeUpdate();
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java
@@ -4,7 +4,6 @@ package org.hibernate.test.hql;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collections;
-import java.util.List;
import junit.framework.Test;
@@ -34,12 +33,6 @@ public class CriteriaHQLAlignmentTest ex
SelectClause.VERSION2_SQL = true;
}
- public String[] getMappings() {
- return new String[] {
- "hql/Animal.hbm.xml",
- };
- }
-
public boolean createSchema() {
return true; // needed for the Criteria return type test
}
@@ -126,7 +119,6 @@ public class CriteriaHQLAlignmentTest ex
// HHH-1724 Align Criteria with HQL aggregation return types.
public void testCriteriaAggregationReturnType() {
Session s = openSession();
- s.beginTransaction();
Human human = new Human();
human.setBigIntegerValue( new BigInteger("42") );
human.setBigDecimalValue( new BigDecimal(45) );
@@ -180,7 +172,6 @@ public class CriteriaHQLAlignmentTest ex
s.delete( human );
s.flush();
- s.getTransaction().commit();
s.close();
}
@@ -233,24 +224,19 @@ public class CriteriaHQLAlignmentTest ex
.setProjection( Projections.count( "nickName" ).setDistinct() )
.uniqueResult();
assertEquals( 2, count.longValue() );
- s.close();
+ s.clear();
s = openSession();
t = s.beginTransaction();
try {
count = ( Long ) s.createQuery( "select count( distinct name ) from Human" ).uniqueResult();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
assertEquals( 2, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleCounts() ) {
- // expected
- }
- else {
- throw ex;
- }
+ // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
+ if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ throw ex;
+ }
}
finally {
t.rollback();
@@ -263,18 +249,13 @@ public class CriteriaHQLAlignmentTest ex
count = ( Long ) s.createCriteria( Human.class )
.setProjection( Projections.count( "name" ).setDistinct() )
.uniqueResult();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
assertEquals( 2, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleCounts() ) {
- // expected
- }
- else {
- throw ex;
- }
+ // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
+ if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ throw ex;
+ }
}
finally {
t.rollback();
@@ -297,17 +278,10 @@ public class CriteriaHQLAlignmentTest ex
t = s.beginTransaction();
try {
count = ( Long ) s.createQuery( "select count( name ) from Human" ).uniqueResult();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
+ fail( "should have failed due to SQLGrammarException" );
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleCounts() ) {
- // expected
- }
- else {
- throw ex;
- }
+ // expected
}
finally {
t.rollback();
@@ -320,17 +294,10 @@ public class CriteriaHQLAlignmentTest ex
count = ( Long ) s.createCriteria( Human.class )
.setProjection( Projections.count( "name" ) )
.uniqueResult();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
+ fail( "should have failed due to SQLGrammarException" );
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleCounts() ) {
- // expected
- }
- else {
- throw ex;
- }
+ // expected
}
finally {
t.rollback();
@@ -343,4 +310,5 @@ public class CriteriaHQLAlignmentTest ex
t.commit();
s.close();
}
+
}
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/orphan/one2one/fk/reversed/unidirectional/DeleteOneToOneOrphansTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/orphan/one2one/fk/reversed/unidirectional/DeleteOneToOneOrphansTest.java
@@ -89,44 +89,4 @@ public class DeleteOneToOneOrphansTest e
cleanupData();
}
-
- public void testOrphanedWhileDetachedFailureExpected() {
- createData();
-
- Session session = openSession();
- session.beginTransaction();
- List results = session.createQuery( "from EmployeeInfo" ).list();
- assertEquals( 1, results.size() );
- results = session.createQuery( "from Employee" ).list();
- assertEquals( 1, results.size() );
- Employee emp = ( Employee ) results.get( 0 );
- assertNotNull( emp.getInfo() );
-
- //only fails if the object is detached
- session.getTransaction().commit();
- session.close();
- session = openSession();
- session.beginTransaction();
-
- emp.setInfo( null );
-
- //save using the new session (this used to work prior to 3.5.x)
- session.saveOrUpdate(emp);
-
- session.getTransaction().commit();
- session.close();
-
- session = openSession();
- session.beginTransaction();
- emp = ( Employee ) session.get( Employee.class, emp.getId() );
- assertNull( emp.getInfo() );
- results = session.createQuery( "from EmployeeInfo" ).list();
- assertEquals( 0, results.size() );
- results = session.createQuery( "from Employee" ).list();
- assertEquals( 1, results.size() );
- session.getTransaction().commit();
- session.close();
-
- cleanupData();
- }
}
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/connections/ConnectionManagementTestCase.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/connections/ConnectionManagementTestCase.java
@@ -130,43 +130,6 @@ public abstract class ConnectionManageme
}
/**
- * Tests to validate that a session holding JDBC resources will not
- * be allowed to serialize.
- */
- public final void testEnabledFilterSerialization() throws Throwable {
- prepare();
- Session sessionUnderTest = getSessionUnderTest();
-
- sessionUnderTest.enableFilter( "nameIsNull" );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
- sessionUnderTest.disconnect();
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
-
- byte[] bytes = SerializationHelper.serialize( sessionUnderTest );
- checkSerializedState( sessionUnderTest );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
- reconnect( sessionUnderTest );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
- sessionUnderTest.disconnect();
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
-
- Session s2 = ( Session ) SerializationHelper.deserialize( bytes );
- checkDeserializedState( s2 );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
- reconnect( s2 );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
-
- s2.disconnect();
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
- reconnect( s2 );
- assertNotNull( sessionUnderTest.getEnabledFilter( "nameIsNull" ) );
-
- release( sessionUnderTest );
- release( s2 );
- done();
- }
-
- /**
* Test that a session which has been manually disconnected will be allowed
* to serialize.
*/
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/connections/Silly.hbm.xml
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/connections/Silly.hbm.xml
@@ -20,6 +20,4 @@
<property name="name"/>
</class>
- <filter-def name="nameIsNull" condition="name is null" />
-
</hibernate-mapping>
\ No newline at end of file
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/instrument/domain/Documents.hbm.xml
@@ -56,7 +56,7 @@
<property name="sizeKb" lazy="true">
<column name="size_mb"
read="size_mb * 1024.0"
- write="? / cast( 1024.0 as float )"/>
+ write="? / 1024.0"/>
</property>
</class>
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/component/basic/ComponentTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/component/basic/ComponentTest.java
@@ -200,9 +200,9 @@ public class ComponentTest extends Funct
.add( Property.forName("person.yob").between( new Integer(1999), new Integer(2002) ) )
.list();
if ( getDialect().supportsRowValueConstructorSyntax() ) {
- s.createQuery("from User u where u.person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 34, 'Peachtree Rd')")
+ s.createQuery("from User u where u.person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 'Peachtree Rd')")
.setDate("dob", new Date("March 25, 1974")).list();
- s.createQuery("from User where person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 34, 'Peachtree Rd')")
+ s.createQuery("from User where person = ('gavin', :dob, 'Peachtree Rd', 'Karbarook Ave', 1974, 'Peachtree Rd')")
.setDate("dob", new Date("March 25, 1974")).list();
}
t.commit();
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/schemaupdate/MigrationTest.java
@@ -40,8 +40,7 @@ public class MigrationTest extends UnitT
SchemaUpdate v2schemaUpdate = new SchemaUpdate( v2cfg );
v2schemaUpdate.execute( true, true );
assertEquals( 0, v2schemaUpdate.getExceptions().size() );
-
- new SchemaExport( v2cfg ).drop( false, true );
+
}
}
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java
@@ -87,70 +87,6 @@ public class CompositeElementTest extend
s.close();
}
- public void testHandSQLSetOfCompositeElementsByAliasFailureExpected() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- Child c = new Child( "Child One" );
- Parent p = new Parent( "Parent" );
- p.getChildren().add( c );
- c.setParent( p );
- s.save( p );
- s.flush();
-
- p.getChildren().remove( c );
- c.setParent( null );
- s.flush();
-
- p.getChildren().add( c );
- c.setParent( p );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- s.createQuery("select c from Parent p left outer join p.children c").uniqueResult();
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- s.delete( p );
- t.commit();
- s.close();
- }
-
- public void testHandSQLSetOfCompositeElementsByPathFailureExpected() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- Child c = new Child( "Child One" );
- Parent p = new Parent( "Parent" );
- p.getChildren().add( c );
- c.setParent( p );
- s.save( p );
- s.flush();
-
- p.getChildren().remove( c );
- c.setParent( null );
- s.flush();
-
- p.getChildren().add( c );
- c.setParent( p );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- s.createQuery("select p.children from Parent p left outer join p.children").uniqueResult(); //we really need to be able to do this!
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- s.delete( p );
- t.commit();
- s.close();
- }
-
public void testCustomColumnReadAndWrite() {
final double HEIGHT_INCHES = 49;
final double HEIGHT_CENTIMETERS = HEIGHT_INCHES * 2.54d;
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/cascade/BidirectionalOneToManyCascadeTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/cascade/BidirectionalOneToManyCascadeTest.java
@@ -118,8 +118,10 @@ public class BidirectionalOneToManyCasca
* Saves the child object with the parent when the one-to-many association
* uses cascade="all-delete-orphan" and the many-to-one association uses
* cascade="all"
+ * <p/>
+ * This test is known to fail. See HHH-2269.
*/
- public void testSaveOrphanDeleteChildWithParent() {
+ public void testSaveOrphanDeleteChildWithParentFailureExpected() {
Session session = openSession();
Transaction txn = session.beginTransaction();
Parent parent = new Parent();
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
@@ -27,6 +27,7 @@ import org.hibernate.criterion.Projectio
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.Subqueries;
+import org.hibernate.dialect.HSQLDialect;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -1000,16 +1001,11 @@ public class CriteriaQueryTest extends F
result = s.createCriteria( Student.class )
.setProjection( Projections.countDistinct( "cityState" ) )
.uniqueResult();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
assertEquals( 1, ( ( Long ) result ).longValue() );
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- // expected
- }
- else {
+ // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
+ if ( ! ( getDialect() instanceof HSQLDialect ) ) {
throw ex;
}
}
@@ -1280,18 +1276,11 @@ public class CriteriaQueryTest extends F
s = openSession();
t = s.beginTransaction();
try {
- List result = s.createCriteria( CourseMeeting.class).setProjection( Projections.countDistinct( "id" ) ).list();
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- fail( "expected SQLGrammarException" );
- }
- assertFalse(result.isEmpty());
- assertEquals( 1, ((Long)result.get(0)).intValue() );
+ Object result = s.createCriteria( CourseMeeting.class).setProjection( Projections.countDistinct( "id" ) ).list();
}
catch ( SQLGrammarException ex ) {
- if ( ! getDialect().supportsTupleDistinctCounts() ) {
- // expected
- }
- else {
+ // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
+ if ( ! ( getDialect() instanceof HSQLDialect ) ) {
throw ex;
}
}
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java
@@ -327,8 +327,6 @@ public class MutableNaturalIdTest extend
.setCacheable( true )
.uniqueResult();
assertNotNull( u );
- s.getTransaction().commit();
- s.close();
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
--- libhibernate3-java-3.5.4.Final.orig/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
+++ libhibernate3-java-3.5.4.Final/testsuite/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java
@@ -227,8 +227,6 @@ public class ImmutableNaturalIdTest exte
.setCacheable( true )
.uniqueResult();
assertNotNull( u );
- s.getTransaction().commit();
- s.close();
assertEquals( getSessions().getStatistics().getQueryExecutionCount(), 1 );
assertEquals( getSessions().getStatistics().getQueryCacheHitCount(), 0 );
|