[Hibernate-JIRA] Created: (HHH-7089) NPE during SessionFactoryImpl init when 2L caching is enabled and @NaturalIdCache is used with EHcache
by Eric Dalquist (JIRA)
NPE during SessionFactoryImpl init when 2L caching is enabled and @NaturalIdCache is used with EHcache
------------------------------------------------------------------------------------------------------
Key: HHH-7089
URL: https://hibernate.onjira.com/browse/HHH-7089
Project: Hibernate ORM
Issue Type: Bug
Affects Versions: 4.1.0
Reporter: Eric Dalquist
The org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory always returns null for buildNaturalIdRegion due to an oversight during work on HHH-6974
The result is that if Second-Level caching is enabled and any entity is annotated with @NaturalIdCache session factory creation fails with a NPE
{noformat}
[java] Caused by: java.lang.NullPointerException
[java] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1740)
[java] at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:88)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
[java] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-7085) Entities marked as @Immutable that have a @NaturalId fail to be inserted with NPE
by Eric Dalquist (JIRA)
Entities marked as @Immutable that have a @NaturalId fail to be inserted with NPE
---------------------------------------------------------------------------------
Key: HHH-7085
URL: https://hibernate.onjira.com/browse/HHH-7085
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Reporter: Eric Dalquist
Due to the work done for HHH-6974 inserting an @Immutable entity with a @NaturalId results in a NullPointerException
The cause appears to be due to read-only entities not having EntityEntry.getLoadedState() populated upon insert and StatefulPersistenceContext.getNaturalIdValues assumes that array will not be null.
{noformat}
Caused by: java.lang.NullPointerException
at org.hibernate.engine.internal.StatefulPersistenceContext.getNaturalIdValues(StatefulPersistenceContext.java:1755)
at org.hibernate.engine.internal.StatefulPersistenceContext.loadedStateInsertedNotification(StatefulPersistenceContext.java:1715)
at org.hibernate.engine.spi.EntityEntry.notifyLoadedStateInserted(EntityEntry.java:390)
at org.hibernate.engine.spi.EntityEntry.postInsert(EntityEntry.java:266)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:95)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1127)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:325)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73)
... 54 more
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-7135) NoSuchElementException in AnnotationBinder.makeInheritanceJoinColumns() when Joined subclass mixed with @MapsId foreign-key id
by Didier Villevalois (JIRA)
NoSuchElementException in AnnotationBinder.makeInheritanceJoinColumns() when Joined subclass mixed with @MapsId foreign-key id
------------------------------------------------------------------------------------------------------------------------------
Key: HHH-7135
URL: https://hibernate.onjira.com/browse/HHH-7135
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Environment: Hibernate 4.1.0.Release, any database
Reporter: Didier Villevalois
Attachments: jpa-test-joined.zip
When you have a joined class hierarchy and the root class is has a foreign-key id, makeInheritanceJoinColumns fails.
@Entity(name = "org.clinigrid.jpa.test.joined.AThing")
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class AThing {
public AThing() {
}
public AThing(ThingHolder holder) {
this.holder = holder;
}
@Id
// @GeneratedValue(generator = "foreign")
// @GenericGenerator(name = "foreign", strategy = "foreign", parameters = { @Parameter(name = "property", value = "holder") })
private Integer id;
@MapsId
@OneToOne(mappedBy = "thing")
private ThingHolder holder;
public Integer getId() {
return id;
}
public ThingHolder getHolder() {
return holder;
}
}
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:757)
at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumn(Ejb3JoinColumn.java:323)
at org.hibernate.cfg.AnnotationBinder.makeInheritanceJoinColumns(AnnotationBinder.java:1125)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:564)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3431)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3385)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1337)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1727)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:88)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at org.clinigrid.jpa.test.joined.JoinedSubclassAndForeignIdTest.test(JoinedSubclassAndForeignIdTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Commenting the @MapsId and un-commenting the @GeneratedValue and @GenericGenerator fixes the problem.
I was not able to find the root of the problem in hibernate's code.
Attached is a test maven project.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-7023) Deprecate HQL-specific (JDBC-style) positional parameters
by Steve Ebersole (JIRA)
Deprecate HQL-specific (JDBC-style) positional parameters
---------------------------------------------------------
Key: HHH-7023
URL: https://hibernate.onjira.com/browse/HHH-7023
Project: Hibernate ORM
Issue Type: Deprecation
Components: query-hql
Reporter: Steve Ebersole
Deprecate the Hibernate-specific (JDBC-style) positional parameters in favor of the JPA-style.
{code}
// HQL positional parameters:
Query q = session.createQuery( "from Cat c where c.name = ?" )
.setParameter( 1, "Tabitha" )
...
// JPQL style:
Query q = em.createQuery( "from Cat c where c.name = ?1" )
.setParameter( 1, "Tabitha" )
...
JPQL style, from Hibernate API:
Query q = em.createQuery( "from Cat c where c.name = ?1" )
.setParameter( "1", "Tabitha" )
...
{code}
This would allow the following from HQL:
{code}
Query q = session.createQuery( "from Cat c where c.name = ?1" )
.setParameter( 1, "Tabitha" )
...
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months