Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Problems with session.filter()
PostPosted: Fri Aug 29, 2003 8:31 am 
Newbie

Joined: Fri Aug 29, 2003 8:27 am
Posts: 2
Hi,

I am having trouble filtering a collection which has been returned by the session.find() method.

The code which I am basically using looks like this:

List result = session.find("...from ... where age > 50...");
List collection = (List) session.filter(result, "where this.name = 'testName'");

When I am running the code it throws the exception: net.sf.hibernate.TransientObjectException: Collection was not yet persistent

Any ideas?

Thanks in advance,
/Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 3:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
collection filters are for filtering persistent collections, not query results.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 3:17 am 
Newbie

Joined: Fri Aug 29, 2003 8:27 am
Posts: 2
Could you clearify? I thought the objects which are stored in the List are persistent?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 3:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Persistent collection is a collection that is represented as a group of entities. For example, the children end of a Many2one association. You can use the filter to collect a subset of the parent's children rather then all of them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

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.