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

Oliver Ringel (JIRA) noreply at atlassian.com
Tue Feb 22 09:51:05 EST 2011


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.1, 3.6.0
            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.
-
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