-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Can't get PluralAttributePath from a MappedSuperclass
PostPosted: Fri Aug 26, 2011 4:57 am 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.