Given the following:
{{{
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="postType",
discriminatorType=DiscriminatorType.STRING)
public class Post {}
@DiscriminatorValue(value = PostType.BUG)
public class BugReport extends Post {}
public class Milestone {
List<Post> posts;
}
}}}
When the posts property of Milestone is lazy loaded, the returned collection
will be a collection of proxies for the class Post.
This is incorrect. In theory, any subclass of Post could exist in the
collection, as determined by the DiscriminatorValue.
Essentially, in HibernateSerializer, we determine the type of the proxy to
return for the entire collection by the elementType in the
`AbstractCollectionPersister`:
{{{
if (persister instanceof AbstractCollectionPersister)
{
AbstractCollectionPersister absPersister = (AbstractCollectionPersister) persister;
String className = absPersister.getElementType().getName();
if (session instanceof Session)
{
List pkIds = getPkIds(session, absPersister, collection);
}}}
Not sure what the solution to this problem is, without a tonne of nasty
reflection.
Original issue reported on code.google.com by martypit...@gtempaccount.com on 16 Sep 2010 at 6:08
Original issue reported on code.google.com by
martypit...@gtempaccount.com
on 16 Sep 2010 at 6:08