|
|
|
|
|
|
I'm trying to get the PluralAttributePath from a collection defined in a MappedSuperclass
{code} @Entity public class Person extends PersonBase {
@Basic private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; } } {code} {code} @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; } } {code} Executing the following {code} criteriaQuery = criteriaBuilder.createQuery(Person.class); root = criteriaQuery.from(Person.class); Path<?> pathAddresses = root.get("addresses"); {code} throws the exception {noformat} 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) {noformat}
|
|
|
|
|
|