[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-4250) @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)

Nicolas De Amicis (JIRA) noreply at atlassian.com
Fri Mar 26 06:19:33 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicolas De Amicis updated HHH-4250:
-----------------------------------

    Attachment: TestCaseHHH4250.zip

Here a TestCase for the bug HHH-4250. 

3 Entities : 
- Account : contains a Set<Client>
- Client : extends Person
- Person : @Inheritance(strategy = InheritanceType.JOINED)

The persistence.xml is configured for HSQLDB on localhost.

First launch the JUnit test Creation : create the DB structure and insert data.
Then launch the JUnit test Read. The stacktrace :

ERROR AssertionFailure:419 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: Table CLIENT_ACCOUNT not found
	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:480)
	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:281)
	at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87)
	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
	at com.valtech.test.Read.setUp(Read.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	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)


> @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
> ----------------------------------------------------------------------------------------
>
>                 Key: HHH-4250
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4250
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>         Environment: Hibernate Core 	 3.3.1.GA
> Hibernate Annotations 	3.4.0 GA
> Hibernate EntityManager 	3.4.0 GA 
> Jboss 4.3 EAP, 
> DB2 9.5
>            Reporter: Tomaz Cerar
>         Attachments: TestCaseHHH4250.zip
>
>
> I am trying to create bidirectional association between two entities in which one can be Inherited and it fails with table not found:
> 11:37:39,229 ERROR [AssertionFailure] [] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
> org.hibernate.AssertionFailure: Table CRM.CRM_AKTIVNOST_DOGODKI not found
>         at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:480)
>         at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:259)
>         at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87)
>         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
>         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
>         at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
>         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
>         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
>         at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
> The code looks like this:
> @Entity
> @Table(name = "CRM_AKTIVNOST")
> public class Aktivnost implements Serializable {
> private List<Dogodek>       dogodki;
> ....
> ....
> @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy = "aktivnost")
> public List<Dogodek> getDogodki() {
>         return dogodki;
> }
> public void setDogodki(List<Dogodek> dogodki) {
>         this.dogodki = dogodki;
> }
> ...
> ...
> }
> @Entity
> @Table(name = "CRM_DOGODEK")
> @Inheritance(strategy= InheritanceType.JOINED)
> public class Dogodek implements Serializable {
> ...
> ...
> private Aktivnost aktivnost;
> ....
> ....
> @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
> 	@JoinTable(name = "CRM_AKTIVNOST_DOGODKI", joinColumns = {@JoinColumn(name = "DOGODEK_ID")}, inverseJoinColumns = {@JoinColumn(name = "AKTIVNOST_ID")})
> 	public Aktivnost getAktivnost() {
> 		return aktivnost;
> 	}
> 	public void setAktivnost(Aktivnost aktivnost) {
> 		this.aktivnost = aktivnost;
> 	}
> ...
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list