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: I think it is hibernate3's bug
PostPosted: Mon Jun 20, 2005 9:50 pm 
Newbie

Joined: Mon Jun 20, 2005 4:32 am
Posts: 4
Hibernate version:

hibernate3.0.5

Mapping documents:

No

Code between sessionFactory.openSession() and session.close():

Code:

return getHibernateTemplate().executeFind(new HibernateCallback() {
   public Object doInHibernate(Session session) throws HibernateException, SQLException {
      DetachedCriteria detachedCriteria = HibernateUtil.getLikeDetachedCriteriaFromBean(user, order, HibernateConstants.DEFAULT_MATCH_MODE);
      return HibernateUtil.getPageResult(detachedCriteria.getExecutableCriteria(session), begin, interval);
   }         
});






Full stack trace of any exception that occurs:

java.lang.ClassCastException: $Proxy2
at org.hibernate.criterion.DetachedCriteria.getExecutableCriteria(DetachedCriteria.java:51)
at org.summerfragrance.security.dao.hibernate.UserDAOHibernate$1.doInHibernate(UserDAOHibernate.java:60)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:292)
at org.summerfragrance.security.dao.hibernate.UserDAOHibernate.findUsers(UserDAOHibernate.java:57)
at org.summerfragrance.security.dao.UserDAOTest.testGetUsers(UserDAOTest.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)



Name and version of the database you are using:

MySql 4.0.11

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


I find these code in org.hibernate.criterion.DetachedCriteria:

Code:

/**
* Get an executable instance of <literal>Criteria</literal>,
* to actually run the query.
*/
public Criteria getExecutableCriteria(Session session) {
   impl.setSession( (SessionImpl) session );
   return impl;
}



because in the runtime environment, the session is a dynamic proxy object, why cast Session into SessionImpl confused I.[/code]


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.