[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5948) Trying to get a PluralAttributePath from a @MappedSuperclass throws org.hibernate.MappingException: Unknown collection role

Oliver Ringel (JIRA) noreply at atlassian.com
Thu Jan 5 12:13:13 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44962#comment-44962 ] 

Oliver Ringel commented on HHH-5948:
------------------------------------

This issue also applies to Hibernate 4.0.0.Final

> Trying to get a PluralAttributePath from a @MappedSuperclass throws org.hibernate.MappingException: Unknown collection role 
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5948
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5948
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.6.0, 3.6.1
>            Reporter: Oliver Ringel
>         Attachments: testcase-hibernate.tgz
>
>
> I'm trying to get the PluralAttributePath from a collection defined in a MappedSuperclass
> @Entity
> public class Person extends PersonBase {
>     @Basic
>     private String name;
>     public String getName() {
>         return name;
>     }
>     public void setName(String name) {
>         this.name = name;
>     }
> }
> @MappedSuperclass
> public abstract class PersonBase {
>     @Id
>     private String id;
>     public String getId() {
>         return id;
>     }
>     public void setId(String id) {
>         this.id = id;
>     }
>     @OneToMany()
>     private Set<Address> addresses = new HashSet<Address>();
>     public Set<Address> getAddresses() {
>         return addresses;
>     }
>     public void setAddresses(Set<Address> addresses) {
>         this.addresses = addresses;
>     }
> }
> Executing the following 
>     criteriaQuery = criteriaBuilder.createQuery(Person.class);
>     root = criteriaQuery.from(Person.class);
>     Path<?> pathAddresses = root.get("addresses");
> throws the exception
>  
> org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses
> 	at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701)
> 	at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58)
> 	at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52)
> 	at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:157)
> 	at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:197)
> 	at testcase.hibernate.HibernateTest.testMappedSuperclassPluralAttribute(HibernateTest.java:53)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list