I'm sorry, my question was not clear.
My DAO exposes the method:
Code:
BaseClass getBaseClassById(Serializable databaseId)
{
return (BaseClass)session.load(BaseClass.class, databaseId);
}
However, consumers of this API need to cast the returned value to specifc instances:
Code:
SpecificClass specificClass = (SpecificClass)dao.getBaseClassById(id);
When lazy loading is enabled for the class, and there is a table per class hierarchy, then the proxy type will not be a subclass of my specific class, and I will get a ClassCastException, correct?
It seems that I have three alternatives
1. Expose an API for every concrete class in my DAO
2. Turn off proxying / lazy loading in the class (which I don't know how to do with annotations).
3. Change my load method to use HQL to force the initial load.
Thanks for your help.