Joined: Fri Aug 26, 2011 4:35 am Posts: 1
|
I'm trying to get the PluralAttributePath from a collection that is defined in a MappedSuperclass
@Entity public class Person extends PersonBase { ... }
@MappedSuperclass public abstract class PersonBase {
@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)
If you move the collection from the MappedSuperclass to the Entity everything works fine.
This is a very simple example and should work (it is working with other jpa providers). Therefore I added an issue to the bug tracker in February together with a test case. But I got no reaction.
Am I doing something wrong or is this a bug? Hopefully someone can help me.
Regards, Oliver
|
|