Problem:
TestDomainObj test = (TestDomainObj) session.createSQLQuery(query).list(); // class cast exception occurs
Solution:
(TestDomainObj) session.createSQLQuery(query)
.addEntity(TestDomainObj.class)
.list();
CreateQuery returns an java.lang.Object array. We can't cast it to our mapped object.
AddEntity fills the mapped object to the appropriate value, so that we can now use our mapped object other than object array
TestDomainObj test = (TestDomainObj) session.createSQLQuery(query).list(); // class cast exception occurs
Solution:
(TestDomainObj) session.createSQLQuery(query)
.addEntity(TestDomainObj.class)
.list();
CreateQuery returns an java.lang.Object array. We can't cast it to our mapped object.
AddEntity fills the mapped object to the appropriate value, so that we can now use our mapped object other than object array
No comments:
Post a Comment