Commit Graph

4506 Commits

Author SHA1 Message Date
Yoann Rodière b8b7a0f19b HHH-12492 Qualify references to columns from the target table in subqueries in DELETE/UPDATE queries
Don't try to duplicate the logic from
org.hibernate.hql.internal.ast.tree.FromElementType#toColumns(java.lang.String, java.lang.String, boolean, boolean)
in other classes, it's complex enough and already seems to handle all
the cases we might encounter.

In this specific case, we want the table name to be used to qualify
column names, because the target table doesn't have any alias (it's not
supported by every version of every RDBMS), and not qualifying columns
at all may lead to a confusing statement, in particular if tables
referenced in the subquery contain columns with the same name.
Since we use aliases for every other table in the query, referencing the
table should not lead to any conflict.
2018-07-27 15:03:13 +02:00
Yoann Rodière 6cf91c832c HHH-12492 Test HQL Delete query with a subquery referencing the parent query's aliases 2018-07-27 15:03:07 +02:00
Martin Simka 77661b2275 HHH-12863 SchemaUpdateTest should be skipped with Sybase 2018-07-27 14:56:35 +02:00
Martin Simka 3e8b35a370 HHH-12851 ConverterTest fails with SQL Server depending on collation 2018-07-23 18:09:54 +02:00
Chris Cranford 27449d2dc2 HHH-12846 - Merge cascade of collection fails when orphan removal enabled with flush mode commit.
(cherry picked from commit 333c190c82)
2018-07-23 11:08:43 -04:00
Martin Simka 95c11255f8 HHH-12844 Fix HbmWithIdentityTest with Oracle 2018-07-20 14:47:43 +02:00
Martin Simka 88a015368b HHH-12843 Fix CreateDeleteTest and FlushIdGenTest with Oracle 2018-07-20 13:22:56 +02:00
Martin Simka 0caee98355 HHH-12839 Fix EntityProxySerializationTest with Oracle 2018-07-20 11:30:11 +02:00
Guillaume Smet d02ad78eb7 HHH-7404 HHH-6776 Add tests to prevent regressions
The issues have apparently already been fixed but let's add the tests
present in the issue to prevent regressions.
2018-07-20 11:30:11 +02:00
Guillaume Smet 0091169f9d HHH-12666 Only run the tests with H2
We don't need to run them with all our dialects: we just need to check
the mechanism works correctly.

At least TransactionExceptionHandlingTest fails with MariaDB so better
be safe.
2018-07-20 11:30:11 +02:00
Guillaume Smet 0075225ab7 HHH-12832 Make SchemaUpdateHaltOnErrorTest use the CustomRunner
Otherwise @SkipForDialect doesn't work.
2018-07-20 10:38:19 +02:00
Martin Simka ad08bdf513 HHH-12838 Fix AndNationalizedTests with DB2
This is consecutive to the changes made in HHH-12753.
2018-07-20 10:27:51 +02:00
Gail Badner 5fd8b36e34 HHH-12666 : Add test 2018-07-20 10:27:05 +02:00
Gail Badner 0bbacccf8d HHH-12666 : Add documentation 2018-07-20 10:27:05 +02:00
Gail Badner a76dde0ec6 HHH-12666 : Added more tests 2018-07-20 10:27:05 +02:00
Yoann Rodière 566a93d6c7 HHH-12666 Test the current behavior of exception conversion on persist/save/merge/flush/etc.
Original tests by Gail Badner:
09aa6fbce2
2018-07-20 10:27:05 +02:00
Gail Badner e5da120f13 HHH-12666 : Add an option for restoring 5.1 native exception handling 2018-07-20 10:27:05 +02:00
Martin Simka ed03dfb958 HHH-12833 Fix UniqueConstraintDropTest with DB2 2018-07-19 16:06:15 +02:00
Chris Cranford 9ca732cf29 HHH-12753 - Remove an override that was not relevant to this jira.
(cherry picked from commit ad5f96c613)
2018-07-19 10:01:52 -04:00
Chris Cranford 86abe7fd4f HHH-12753 - Fix Nationalized CLOB test failures on DB2.
Force column read/write to use non-nationalized driver methods since the driver does
not implement the nationalized equivalents.

(cherry picked from commit 005d5b7c74)
2018-07-19 09:54:46 -04:00
nikowitt 722ba32f9f HHH-12830 Improve error message when a method is called in a non active
transaction
2018-07-19 15:36:59 +02:00
Guillaume Smet 255a096ee8 HHH-12832 Skip SchemaUpdateHaltOnErrorTest and al. with DB2
DB2 has no issue with reserved keywords in the CREATE TABLE clause so
let's skip these tests.

There is very little value to test them for every dialect anyway.
2018-07-19 15:18:42 +02:00
Guillaume Smet d6f8d2e7a0 HHH-12822 Skip "case when" tests requiring casts for DB2 2018-07-19 15:18:42 +02:00
Guillaume Smet 3747352ec5 HHH-12827 Define a numeric type as decimal for DB2
DB2 converts the numeric type to decimal and returns Types.DECIMAL for a
numeric. We change the type name used so that we have a match when
comparing the type names as last resort.
2018-07-19 15:18:42 +02:00
Guillaume Smet 7174b03a25 HHH-12815 Remove the zeroDateTimeBehavior option
It's useless for this test and it causes compatibility issues.
2018-07-19 15:18:42 +02:00
Guillaume Smet 1945180569 HHH-12791 Cache the Component type to avoid generating one proxy per call
While Javassist only generates one proxy as the name is stable,
ByteBuddy uses random names and thus generates a new proxy for every
call, leading to the generation of 18 different proxies for the other
test of the test class.

We can't do better than using a volatile/synchronized pattern as the
Component is not fully initialized in the constructor.

Maybe we could take the risk of admitting that the getType() method is
called at least once before we pass the element to a multi-threaded
environment but that's a bet I don't want to take alone.
2018-07-19 10:02:03 +02:00
Chris Cranford 4fc2ce7ab7 HHH-12826 - Persist cascade of collection fails when orphan removal enabled with flush mode commit.
(cherry picked from commit 3fe7d6e13e)
2018-07-18 18:10:58 -04:00
Chris Cranford d24685de67 HHH-12542 - Add necessary privileged action blocks for SecurityManager used on WildFly. 2018-07-18 17:50:27 +02:00
Martin Simka d23fc129cc HHH-12825 CriteriaHQLAlignmentTest.testCountReturnValues fails on databases that don't support tuple distinct counts because it expects wrong exception 2018-07-18 16:03:24 +02:00
Martin Simka 2f12913b98 HHH-12824 ASTParserLoadingTest.testComponentNullnessChecks fails with DB2 because it uses legacy-style query parameter 2018-07-18 16:00:41 +02:00
Martin Simka 103de8de84 HHH-12823 CompositeIdTest.testDistinctCountOfEntityWithCompositeId fails on databases that don't support tuple distinct counts because it expects wrong exception
The SQLGrammarException is now wrapped in a PersistenceException, we
should take that into account.
2018-07-18 14:38:45 +02:00
Guillaume Smet dde8744ca3 HHH-12718 Add a comment about the true meaning of interceptorHandledDirtyCheck 2018-07-17 12:10:19 +02:00
Yoann Rodière da2d986efb HHH-12718 Avoid double negations in DefaultFlushEntityEventListener#dirtyCheck 2018-07-17 12:10:19 +02:00
Yoann Rodière e53e0ef790 HHH-12718 Compute dirtiness using whatever method is appropriate after a flush event interception
We used to have a simpler version of the dirtyCheck() method after an
interception, but that's not enough.
2018-07-17 12:10:19 +02:00
Yoann Rodière 47107e3e88 HHH-12718 Test that dirtiness strategies are invoked a second time after a flush interceptor changes the entity state
Bytecode enhancement is harder to test, so I didn't add a test for that,
but since bytecode enhancement dirty checking is called exactly at the
same place, if one works, the other should, too.
2018-07-17 12:10:19 +02:00
Ulrich Bestfleisch a180caecd6 HHH-12718 - Entity changes in @PreUpdate callback are not persisted when lazy loading is active for more than one field 2018-07-17 12:10:19 +02:00
Yoann Rodière af427cb6c5 HHH-12795 Test the flushMode attribute of @NamedQuery and @NamedNativeQuery 2018-07-17 11:07:41 +02:00
Yoann Rodière 36fcadaa6a HHH-12795 Use the exact flush mode specified in @NamedQuery/@NamedNativeQuery when instantiating named queries
... instead of using an approximation in terms of JPA flush mode.
2018-07-17 11:07:41 +02:00
Guillaume Smet e4ae86cce2 HHH-12811 Add @Target annotations to @CreationTimestamp and @UpdateTimestamp 2018-07-17 10:59:39 +02:00
Guillaume Smet 1688c3ff8d HHH-12786 Improve the basic proxy interceptor
Apart from cosmetic changes, we were testing in the equals() method that the
instance == the proxied object which will always be true.

We should use the argument of the equals() method instead to do the
comparison.

And we can do the comparison on the instance, instead of requiring
passing the proxiedObject into the interceptor.
2018-07-16 17:35:15 +02:00
Guillaume Smet 67698b8bdb HHH-12786 Only define the default constructor
We don't need the others, better not create them in the proxy.
2018-07-16 17:35:15 +02:00
Guillaume Smet 0fda6be86e HHH-12786 Allow to call methods when the interceptor is not set yet
Typically, if the constructor calls instrumented methods, the
interceptor is not defined yet and we get a NPE.
2018-07-16 17:35:15 +02:00
Guillaume Smet 297031319d HHH-12786 Properly indent the Bytebuddy DSL
It helps to understand what exactly these calls do.
2018-07-16 17:35:15 +02:00
Guillaume Smet 667b565028 HHH-12804 Don't mock Map in CollectionBinderTest
Apparently, Mockito + ByteBuddy are unable to mock Map on JDK 11.

It might be solved in the future but there's no point in doing it so
let's avoid it.
2018-07-16 15:07:56 +02:00
Guillaume Smet a9e20c18c5 HHH-12801 Adjust the assertion to the new message generated by JDK 11 2018-07-16 15:07:56 +02:00
Guillaume Smet 9d36d1d91f HHH-12800 Use a class loading strategy suitable for the JDK used
The previously chosen strategy used misc.Unsafe which is not possible
anymore with JDK 11.
2018-07-16 15:07:56 +02:00
Gail Badner 7e69797a45 HHH-12802 : Fix test case to recover from exception properly
(cherry picked from commit 9202a5a11d)
2018-07-13 15:53:46 -07:00
Gail Badner 3af8b6235a HHH-12802 : Hibernate does not thrown an exception when more than entity is loaded with the same ID
(cherry picked from commit 926ad5a133)
2018-07-13 14:51:12 -07:00
Gail Badner ff18d904e8 HHH-12802 : test case
(cherry picked from commit 2ef777e3fe)
2018-07-13 14:50:51 -07:00
Vlad Mihalcea 4b51867c44 HHH-12771 - Caused by: java.lang.UnsupportedOperationException: Cache provider [org.hibernate.cache.ehcache.internal.EhcacheRegionFactory@3271ec2a] does not support `transactional` access 2018-07-13 09:43:03 +03:00