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

Jai M (JIRA) noreply at atlassian.com
Wed Jun 24 16:22:33 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33463#action_33463 ] 

Jai M commented on ANN-793:
---------------------------

I am also seeing this issue. I have a base class called Resource and a subclass called Action.  Action class has  @Inheritance(strategy= InheritanceType.JOINED). Resource is also an entity.
Now If I define a 

@ManyToOne
@JoinTable(name = "ACTION_ACTIONTYPE", joinColumns = @JoinColumn(name = "ACTIONID"))

with another class called ActionType, I get  the following error

Caused by: org.hibernate.AssertionFailure: Table ACTION_ACTIONTYPE 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)



> @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
> ----------------------------------------------------------------------------------------
>
>                 Key: ANN-793
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-793
>             Project: Hibernate Annotations
>          Issue Type: Bug
>    Affects Versions: 3.4.0.GA
>         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
>
> 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