Commit Graph

9620 Commits

Author SHA1 Message Date
Andrea Boriero 6ebafc1cae HHH-16108 NullPointerException when flushing a (simple) entity update for models with bytecode enhancement and multiple one-to-one associations (some lazy) 2023-01-26 18:09:14 +01:00
Yoann Rodière 6bc1b24443 HHH-16108 Test a (simple) entity update for models with bytecode enhancement and multiple one-to-one associations (some lazy)
Stack trace:

java.lang.NullPointerException: Cannot invoke "org.hibernate.metamodel.mapping.SelectableMapping.isFormula()" because "selectable" is null

	at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.processSet(UpdateCoordinatorStandard.java:665)
	at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.processAttribute(UpdateCoordinatorStandard.java:640)
	at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.analyzeUpdateValues(UpdateCoordinatorStandard.java:600)
	at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.performUpdate(UpdateCoordinatorStandard.java:256)
	at org.hibernate.persister.entity.mutation.UpdateCoordinatorStandard.coordinateUpdate(UpdateCoordinatorStandard.java:203)
	at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2766)
	at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:165)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:616)
	at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:487)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:484)
	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358)
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412)
	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:485)
	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2277)
	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:1942)
	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:426)
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:169)
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:267)
	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
	at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:128)
	at org.hibernate.testing.transaction.TransactionUtil2.lambda$inTransaction$0(TransactionUtil2.java:76)
	at org.hibernate.testing.transaction.TransactionUtil2.inSession(TransactionUtil2.java:35)
	at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:74)
	at org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase.inTransaction(BaseNonConfigCoreFunctionalTestCase.java:590)
	at org.hibernate.orm.test.bytecode.enhancement.lazy.proxy.LazyOneToOneMultiLevelTest.testPersist(LazyOneToOneMultiLevelTest.java:56)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
2023-01-26 18:09:14 +01:00
Andrea Boriero 6c385f7890 HHH-16106 Using BatchEntitySelectFetchInitializer causes PostLoad to be called before references are initialized 2023-01-26 16:14:46 +01:00
Andrea Boriero 10458da711 HHH-16106 Add test for issue 2023-01-26 16:14:46 +01:00
Vedran Prišćan d18cdbec35 HHH-16096 Passing an ExtendedBeanManager which is notified too late leads to initialization error 2023-01-26 09:03:28 -06:00
Marco Belladelli 94b20bafc8 HHH-16070 Check for type parameters when setting declared identifier 2023-01-26 13:52:34 +01:00
Marco Belladelli 3bfb2f66a1 HHH-16070 Add test for issue 2023-01-26 13:52:34 +01:00
Marco Belladelli 7cd6d0422f HHH-16023 Check fetchable declaring type when not found in persister 2023-01-26 13:06:50 +01:00
Marco Belladelli 64b3855c73 HHH-16023 Add test for issue 2023-01-26 13:06:50 +01:00
Sanne Grinovero ae37509b11 HHH-16099 Introduce three-state handling for dirty levels to avoid excessive warnings
We now differentiate between an Attribute which has been marked as "real dirty" from
one which needs to be "treated like dirty", so to not bother end users with a WARN
log when a non-updateable property had not been updated explicitly by them.
2023-01-26 08:35:26 +00:00
Steve Ebersole e27dc5bc47 HHH-16103 - MERGE for optional table updates on SQL Server 2023-01-26 00:41:58 -06:00
Steve Ebersole 5525b8d9b7 HHH-16103 - MERGE for optional table updates on SQL Server 2023-01-26 00:41:58 -06:00
Steve Ebersole a742f5e988 HHH-16069 - Skip CDI for Hibernate extensions by default 2023-01-26 00:29:24 -06:00
Sanne Grinovero 9e033c8aea HHH-16099 Minor refactoring, extract local constants in UpdateCoordinatorStandard 2023-01-25 21:52:21 +00:00
Gavin e00bdc7cb2 fix typo in jdoc 2023-01-25 22:04:03 +01:00
Sanne Grinovero 0b5cb6c649 HHH-16090 BasicResultAssembler logging optimisations 2023-01-25 17:57:26 +00:00
Christian Beikov 033eeb7241 Make session part of JdbcValueBindings 2023-01-25 18:15:11 +01:00
Christian Beikov e841b0aaae Get rid of some capturing lambdas 2023-01-25 18:15:11 +01:00
Steve Ebersole 420e561f21 HHH-16099 - Log about immutable properties only if dirty on update 2023-01-25 11:00:12 -06:00
Marco Belladelli eca3ff13bd HHH-16062 Apply settings and hints to criteria queries 2023-01-25 17:52:33 +01:00
Marco Belladelli 136169d43a HHH-16062 Add test for issue 2023-01-25 17:52:33 +01:00
Yoann Rodière 528d897c4d HHH-16085 Test mapping arrays with @JdbcTypeCode(Type.VARBINARY)
This is useful to revert to pre-6.1 behavior for array mapping in particular.
2023-01-25 17:47:30 +01:00
Christian Beikov e464f53df8 Fix compile error 2023-01-25 17:43:52 +01:00
Andrea Boriero 49779ed4dc HHH-16005 Add test for issue 2023-01-25 17:13:40 +01:00
Andrea Boriero f15d6ee5fb HHH-16025 Using BatchEntitySelectFetchInitializer with caching leads to caching wrong values 2023-01-25 17:05:35 +01:00
Andrea Boriero ac0a27eca2 HHH-16025 Add test for issue 2023-01-25 17:05:35 +01:00
Andrea Boriero b033b88472 HHH-15921 @BatchSize and @IdClass on join column throws exception 2023-01-25 17:05:35 +01:00
Andrea Boriero dbaca049c8 HHH-16039 Add test for issue 2023-01-25 17:05:35 +01:00
Andrea Boriero 8d0729f543 HHH-15921 Add test for issue 2023-01-25 17:05:35 +01:00
Marco Belladelli f9b169242a HHH-16043 Correct single ID and init empty for batch collection loading 2023-01-25 17:01:31 +01:00
Marco Belladelli 17506b7f80 HHH-16043 Add test for issue 2023-01-25 17:01:31 +01:00
Sanne Grinovero 2d7774b9ab HHH-16091 Optimize also AbstractStandardBasicType#compare and #fromString 2023-01-25 14:21:29 +00:00
Sanne Grinovero 12c7252c59 HHH-16091 Make AbstractStandardBasicType#getMutabilityPlan return a constant too 2023-01-25 14:21:29 +00:00
Sanne Grinovero b77bbf0650 HHH-16091 Make AbstractStandardBasicType#getReturnedClass return a constant 2023-01-25 14:21:29 +00:00
Sanne Grinovero 12abcc4c60 HHH-16091 AbstractStandardBasicType to avoid megamorphic dispatch when dealing with AbstractClassJavaType 2023-01-25 14:21:29 +00:00
Sanne Grinovero 1652102c1a HHH-16092 Trim allocation size of CacheKeyImplementation, avoid Objects::deepEquals 2023-01-25 12:00:38 +00:00
Gavin 4ca5902672 mention the query result set cache in the javadoc 2023-01-25 09:52:37 +01:00
Christian Beikov a0d162cde8 Fix test failure by respecting custom insert/delete SQL for secondary tables 2023-01-25 09:32:16 +01:00
Gavin 0bb04b1021 HHH-16089 allow @Synchronize for a collection 2023-01-25 00:19:42 +01:00
Steve Ebersole 2a24876f69 HHH-16084 - MERGE (upsert) for optional table updates - H2 2023-01-24 10:00:54 -06:00
Steve Ebersole 21b7745768 HHH-16084 - MERGE (upsert) for optional table updates - H2 2023-01-24 10:00:54 -06:00
Marco Belladelli 998f2ef21f HHH-15933 Better property owner check + new test case for JoinedSubclass 2023-01-24 14:16:08 +01:00
Marco Belladelli 49690bf4ce HHH-15933 Table reference by name and change referenced property owner 2023-01-24 14:16:08 +01:00
Andrea Boriero a4e2fe57cc HHH-16033 Many-to-Many inverse mapping referencing the same class uses pk instead of fk field for removal 2023-01-24 10:49:31 +01:00
William Burns ea8b0649a2 HHH-16033 Many-to-Many inverse mapping referencing the same class uses pk instead of fk field for removal
* Just reproducer for issue
2023-01-24 10:49:31 +01:00
Andrea Boriero 1638c074d5 HHH-16031 @ManyToMany with @JoinTable(inverseColumn = ...) and SortedSet may results in data loss 2023-01-24 10:49:31 +01:00
Andrea Boriero f4aec1cd0a HHH-16031 @ManyToMany with @JoinTable(inverseColumn = ...) and SortedSet may results in data loss 2023-01-24 10:49:31 +01:00
Yoann Rodière 241fe54d0a HHH-16031 Test @ManyToMany + @JoinTable(inverseColumn) on a SortedSet 2023-01-24 10:49:31 +01:00
Andrea Boriero 0983b47252 HHH-16049 Setting a property to its current value with bytecode enhancement enabled results in unnecessary SQL Update in some (many) cases 2023-01-24 10:40:52 +01:00
Andrea Boriero 3d9a1bce9b HHH-16049 Test setting a property to its current value with bytecode enhancement enabled 2023-01-24 10:40:52 +01:00
Yoann Rodière 5bd1f7c05b HHH-16049 Test setting a property to its current value with bytecode enhancement enabled 2023-01-24 10:40:52 +01:00
Yoann Rodière acbfa0a060 HHH-16049 Restructure lazy-basic tests for easier re-execution and better test reports 2023-01-24 10:40:52 +01:00
Marco Belladelli 12c69c8528 Fix wrong version check in from dual for select only for MySQL 2023-01-24 09:05:04 +01:00
Steve Ebersole 6e442aaed5 HHH-16077 - Added named native queries cannot specify result-class 2023-01-23 21:32:31 -06:00
Steve Ebersole e7b2f9b121 HHH-16077 - Added named native queries cannot specify result-class 2023-01-23 20:26:49 -06:00
Gavin 4a37bf8017 fix another typo 2023-01-23 16:54:34 +01:00
Gavin ea6d76b9b4 fix typos 2023-01-23 16:49:23 +01:00
Gavin 6e590a0149 clean up impl of query hint interpretation
use 'switch' statements
2023-01-23 16:34:10 +01:00
Marco Belladelli 8755129648 HHH-16050 StandardStack optimization using custom array implementation 2023-01-23 11:51:57 +00:00
Andrea Boriero 01db71c272 HHH-16061 SqmDynamicInstantiation warns about dynamic Map instantiation when using an entity 2023-01-23 09:16:55 +01:00
Andrea Boriero e6b94398de HHH-16061 Add test for issue 2023-01-23 09:16:55 +01:00
Gavin e0e3921503 more query space javadoc improvements 2023-01-22 21:25:13 +01:00
Gavin 662594fd5f HHH-16079 rewrite javadoc relating to query spaces + add @Synchronize(logical=false) 2023-01-22 14:50:50 +01:00
Gavin 75f3f699b5 very minor cleanups 2023-01-22 14:50:50 +01:00
Steve Ebersole 35f0c57f07 HHH-15949 - Make MetadataBuilderContributor discoverable 2023-01-20 17:45:11 -06:00
Steve Ebersole b5022f94d3 HHH-15949 - Deprecate MetadataContributor 2023-01-20 16:42:14 -06:00
Steve Ebersole bab25b42e4 HHH-16077 - Added named native queries cannot specify result-class 2023-01-20 15:47:54 -06:00
Sanne Grinovero 94054f6a57 HHH-16072 Restore SPI removal SharedSessionContractImplementor.getTransactionStartTimestamp() 2023-01-20 21:37:55 +00:00
Sanne Grinovero 800873c43d HHH-16058 Removing Environment#getBytecodeProvider 2023-01-20 14:31:08 +00:00
Andrea Boriero 1e21d1c6d1 HHH-16006 Fix checkstyle error 2023-01-20 14:53:41 +01:00
Gavin 1b09d20da0 deprecate config property org.hibernate.flushMode on AvailableSettings
it's actually a JPA hint, and rightfully belongs on HibernateHints
2023-01-20 11:29:59 +01:00
Gavin a986a3806a add convenience method to retrieve Dialect from FunctionContributions
because in fairness this is a little hard to find
2023-01-19 23:57:40 +01:00
Steve Ebersole a552a73632 HHH-16006 - Implement an "additional mapping" contributor SPI 2023-01-19 16:30:46 -06:00
Davide D'Alto e03b3f051a
HHH-16059 Add getters to CteInsertHandler
And the relax scope of a private method.

This way Hibernate Reactive can access them.
2023-01-19 12:28:40 +01:00
Davide D'Alto e2baceb382
HHH-16059 Add getters and relax scopes
extending CteInsertStrategy and CteMutationStrategy
2023-01-19 11:00:38 +01:00
Jan Schatteman f53a29ab12 HHH-16020 - Fix for incorrect offset parameter index and add test for
issue

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
2023-01-18 19:59:07 +01:00
Sanne Grinovero 67dc1ed835 HHH-16052 EntityKey and CollectionKey equality optimisation 2023-01-17 16:47:22 +00:00
Gavin cf65a2d275 improve javadoc for hibernate.hbm2ddl.import_files_sql_extractor 2023-01-17 00:43:52 +01:00
Sanne Grinovero 84a652bfe7 HHH-16051 Avoid stateful lambdas on invocations of Stack#findCurrentFirst 2023-01-16 21:39:15 +00:00
Sanne Grinovero c570b11dcd HHH-16047 Allow reusing of FlushEntityEvent instances 2023-01-16 15:11:15 +00:00
Sanne Grinovero 9f88b56099 HHH-16046 Improve memory safety of mutations in EventListenerGroupImpl
Also avoid for method listeners() to allocate a new List at each use;
 this method was deprecated but it appears it’s still being used in
 various event processors, which is being flagged as a performance issue.
2023-01-15 11:31:27 +00:00
Sanne Grinovero 48df4e15aa HHH-16046 EventListener iterations should avoid using EventListenerGroup#listeners when possible 2023-01-15 11:31:27 +00:00
Gavin a1d43adad4 Oracle does support offsets/zones in datetime literals
+ some minor cleanups
2023-01-14 15:14:04 +01:00
Gavin 6a238adc6c tolerate 'local' keyword in date and time literals
no reason to choke on this, doesn't seem to be ambiguous
2023-01-14 15:14:04 +01:00
Gavin 4a87bc4bb8 use custom-rendered datetime literals on MySQL instead of JDBC escapes 2023-01-14 15:14:04 +01:00
Gavin 2aece6fb95 HHH-16035 use custom-rendered datetime literals on DB2 instad of JDBC escapes
The JDBC escapes didn't play so well with duration arithmetic.
2023-01-14 15:14:04 +01:00
Gavin 8f29ae95c9 more javadoc for Dialect.getFractionalSecondPrecisionInNanos() 2023-01-14 15:14:04 +01:00
Gavin 56774f80d7 fix handling of typestamp arithmetic on Sybase
this was a total inconsistent mess that made no sense
2023-01-14 15:14:04 +01:00
Gavin c852d1ca0d more HQL duration tests 2023-01-14 15:14:04 +01:00
Gavin a9414fa6be disable test for no-longer-allowed literal syntax
I had to disallow this because it was too ambiguous
2023-01-13 16:34:46 +01:00
Gavin ae978b3d10 fix an ambiguity in the grammar of datetime literals
this was my very stupid mistake
2023-01-13 16:34:46 +01:00
Gavin 43cce5fe5e HHH-16035 fix bug with Durations magnitude being off by 10^9 2023-01-13 16:34:46 +01:00
Gavin 2f5f5b9a50 HHH-16035 add a test for cast(duration as Long) + tests for duration arithmetic/literals
(pulls in duration arithmetic tests from other branch)
2023-01-13 16:34:46 +01:00
Gavin 6f7b17d36b HHH-16035 change the default for hibernate.type.preferred_duration_jdbc_type to NUMERIC
There's really no value at all in having h2 as the only platform where Duration
is persisted as 'interval second' by default. People usually use h2 for testing,
and probably actually prefer if the schema is more similar to the schema of
their "real" database.

Also, this tiny change fixes issues 1. and 2. of HHH-16035 as a side-effect.
2023-01-13 16:34:46 +01:00
Matías Santurio 669be6a776 HHH-16038 Fix PersistenceContext.setDefaultReadonly javadoc mistake 2023-01-13 15:02:39 +01:00
Christian Beikov 80b638aeca Introduce getSingleJdbcMapping() and getJdbcMapping(int) to improve JdbcMappingContainer accesses 2023-01-13 09:04:15 +01:00
Sanne Grinovero d64873bde6 HHH-15305 Some dead code elimination and analysis cleanup 2023-01-12 22:24:39 +00:00
Sanne Grinovero 3d4cb14627 HHH-15305 Switch size management in BoundedConcurrentHashMap to use an AtomicInteger 2023-01-12 22:00:36 +00:00
franz1981 7e5c3c8dde HHH-15305 Update custom LIRS implementation based on BoundedConcurrentHashMap 2023-01-12 21:49:08 +00:00
Andrea Boriero 2143ced49e HHH-15604 Identically-named association in entity root and elementcollection of embeddables leads to assertion error 2023-01-12 18:19:38 +01:00