[hibernate-issues] [Hibernate-JIRA] Created: (ANN-793) @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
Tomaz Cerar (JIRA)
noreply at atlassian.com
Fri Jan 9 05:49:38 EST 2009
@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