[jboss-jira] [JBoss JIRA] Resolved: (EJBTHREE-647) SecondaryTable

Emmanuel Bernard (JIRA) jira-events at lists.jboss.org
Tue Feb 13 22:01:30 EST 2007


     [ http://jira.jboss.com/jira/browse/EJBTHREE-647?page=all ]

Emmanuel Bernard resolved EJBTHREE-647.
---------------------------------------

    Resolution: Won't Fix
      Assignee: Emmanuel Bernard

Hibernate does not sipport JOINED and secondary table, you can do the equivalent mapping using SINGLE_TABLE and mapping the "JOINED" tables as secondary tables

> SecondaryTable
> --------------
>
>                 Key: EJBTHREE-647
>                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-647
>             Project: EJB 3.0
>          Issue Type: Bug
>          Components: EJB3 Extensions
>    Affects Versions: EJB 3.0 RC8 - FD
>         Environment: PC Intel 2.8GHz, 1G RAM, OpenSuSE 10.0, Eclipse 3.1.2, JBoss-IDE 1.5.1.GS, AS JBoss-4.0.4.GA
>            Reporter: Jose Jesus
>         Assigned To: Emmanuel Bernard
>
> I'm using @SecondaryTable annoration and at deploy moment an exception occurs:
> 10:10:46,141 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 PERSON not found
> 	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:444)
> 	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:225)
> 	at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
> 	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223)
> 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
> 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
> 	at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
> 	at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
> 	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
> 	at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
>               :
>               :
> 10:10:46,189 WARN  [ServiceController] Problem starting service persistence.units:jar=sgscore-ejb3.jar,unitName=sgscore
> org.hibernate.AssertionFailure: Table PERSON not found
> 	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:444)
> 	at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:225)
> 	at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
> 	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223)
> 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
> 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
> 	at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
> 	at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
> 	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
> 	at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
>               :
>               :
> my code and annotations are:
> @Entity
> @Table(name="USER")
> @Inheritance(strategy = InheritanceType.JOINED)
> @SecondaryTable(name = "PERSON", pkJoinColumns = { 
>         @PrimaryKeyJoinColumn(name = "PERSON_ID", referencedColumnName = "ID") 
>         }
> ) 
> public class User extends Participant {
>    private String firstName;
>               :
>               :
>    @Column(name="FIRST_NAME", table="PERSON")
>    public String getFirstName(){
>       return firstName;
>    }
>    public void setFirstName(String firstName) {
>       this.firstName = firstName;
>    }
>               :
>               :
> }
> @Entity
> @Table(name="PERSON")
> public class Person {
>    private String firstName;
>               :
>               :
>    @Column(name="FIRST_NAME")
>    public String getFirstName() {
>       return firstName;
>    }
>    public void setFirstName(String firstName) {
>       this.firstName = firstName;
>    }
>               :
>               :
> }
> @Entity
> @Table(name="PARTICIPANT")
> @Inheritance(strategy = InheritanceType.JOINED)
> public class Participant {
>    private String id;
>               :
>               :
>    @Id
>    public String getId() {
>       return id;
>    }
>    public void setId(String id) {
>       this.id = id;
>    }
>               :
>               :
> }
> Another observation is that in User class SecondaryTable annotation I already try:
> @SecondaryTable(name="PERSON")
> AND
> @SecondaryTables({
>       @SecondaryTable(name = "PERSON", pkJoinColumns = {
>             @PrimaryKeyJoinColumn(name = "PERSON_ID", referencedColumnName = "ID") 
>          }
>       )
>    }
> )
> AND
> @SecondaryTables({
>       @SecondaryTable(name = "PERSON")
>    }
> )
> the same exception occurs. 
> What's the problem with implementation code or annotations???
> Thank's.

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

        



More information about the jboss-jira mailing list