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

Gail Badner (JIRA) noreply at atlassian.com
Fri Jan 6 02:35:09 EST 2012


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-5948:
-----------------------------

    Affects Version/s: 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, 4.0.0.Final
>            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