Hi All
I have a class and 2 joined-subclasses. The parent class is AbstractDatasource. The 2 sub classes are JDBCDatasource and BeanDatasource. When I retreive a list of AbstractDatasource using the foloowing code
Code:
DetachedCriteria detachedCriteria = DetachedCriteria.forClass( AbstractDatasource.class );
List objects = getHibernateTemplate( ).findByCriteria( detachedCriteria );
I discover that the objects arent of the correct class. I know this because I have 1 BeanDatasource in the database and when I try to convert the BeanDatasource using the following code:
Code:
(BeanDatasource)objects.get(0);
but I get a ClassCastException. This I beleive has to do with some kind of proxy that is used by Hibernate. I was wandering how can I turn of this proxy, that is if it's the problem or is there something else wrong?
When I do a System.out.println( objects.get(0) ) I see this
com.mycompany.AbstractDatasource$$EnhancerBYCGLIB$$ but this should show com.mycompany.BeanDatasource.
Thanks in advance,
Martyn