[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-686) SubClass with EmbeddedId or IdClass containing @ManyToOne fail at startup

cpp.expert (JIRA) noreply at atlassian.com
Wed Nov 26 18:56:15 EST 2008


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

cpp.expert commented on ANN-686:
--------------------------------

Is there workaround against this issue ? It's been almost a year since reported.

> SubClass with EmbeddedId or IdClass containing @ManyToOne fail at startup
> -------------------------------------------------------------------------
>
>                 Key: ANN-686
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-686
>             Project: Hibernate Annotations
>          Issue Type: Bug
>    Affects Versions: 3.3.0.ga, 3.3.1.beta1
>            Reporter: Marcos Sousa
>            Priority: Minor
>
> I subclass Customer that has a EmbeddedId using JOIN inheritance strategy. My embeddable class has @ManyToOne relationship. Look the classes:
> Pesson class:
> @Entity
> @Table(name="person")
> public class Person {
>    @Id
>    private Integer personId;
>    private String name;
> }   
> Embeddable class ID.
> @Embeddable
> public class PersonPk implements Serializable {
>    @ManyToOne(optional=false,
>            cascade={CascadeType.PERSIST,
>            CascadeType.REFRESH,
>            CascadeType.REMOVE}, fetch=FetchType.EAGER)
>    @JoinColumn(name="personId")
>    private Person person;
>    // ... getters and setters
> } 
> CustomerClass:
> @Entity
> @Table(name="Customer")
> @Inheritance(strategy=InheritanceType.JOINED)
> public class Customer {
>    @Id
>    private PersonPk pk = new PersonPk();
> } 
> Regional Custumer:
> @Entity
> @Table(name="AmericanCustomer")
> @PrimaryKeyJoinColumn(name="personId")
> @IdClass(PessoaPk.class)
> public class AmericanCustomer extends Customer {
>    // some american customer fields..
> } 
> This mapping throw this exception at hibernate startup:
> Invocation of init method failed; nested exception is java.util.NoSuchElementException
> Caused by: 
> java.util.NoSuchElementException
> 	at java.util.AbstractList$Itr.next(Unknown Source)
> 	at org.hibernate.util.JoinedIterator.next(JoinedIterator.java:53)
> 	at org.hibernate.cfg.Ejb3JoinColumn.buildJoinColumn(Ejb3JoinColumn.java:210)
> 	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:463)
> 	at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:501)
> 	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:282)
> 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
> 	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:918)

-- 
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