-->
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: StatelessSession getting a "collections cannot be fetch
PostPosted: Tue May 23, 2006 10:13 am 
Beginner
Beginner

Joined: Fri Mar 12, 2004 1:02 pm
Posts: 23
Hi,

I'm trying to create new DAOs using hibernate stateless sessions due to integration requirements and for particular retrieve methods I consistently run into the hibernate exception: "org.springframework.orm.hibernate3.HibernateSystemException: collections cannot be fetched by a stateless session".

I've been following the stateless session example from the hibernate docs--http://www.hibernate.org/hib_docs/v3/reference/en/html/batch.html--using Scrollable results with no success. Here is a snippet of the retrieval method in my DAO:

------------
StatelessSession session = getSessionFactory().openStatelessSession();
Transaction tx = session.beginTransaction();
try {
Customer customer = null;
Query query = session.createQuery("FROM Customer WHERE customerCode = :customerCode");
query.setString("customerCode", customerCode);
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
if (results.next()) {
customer = results.get(0);
}
return customer;
} catch (HibernateException he) {
throw convertHibernateAccessException(he);
} finally {
tx.commit();
session.close();
}
---------------


Any help would be appreciated. Thanks!

-los


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