-->
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.  [ 8 posts ] 
Author Message
 Post subject: missing query() method from new HHH PersistentSet
PostPosted: Wed Feb 09, 2005 6:20 am 
Beginner
Beginner

Joined: Wed Feb 04, 2004 4:54 am
Posts: 25
with hibernate2 I extended net.sf.hibernate.collection.Set and used its methods to apply query filters to the lazy collection. (query() for example).

Now I've seen that Set doensn't exists anymore and the new PersistentSet doesn't have this methods.

I've read the "Hibernate3 Migration Guide" and javadocs for hibernate3 but I'm not sure wether the new "subquery" functionality is the feature I need or not.

Any hints?

_________________
Stefano Bagnara


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 6:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Are you telling me you wrote your application code to depend on net.sf.hibernate.collection.Set? An internal implentation class?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 9:21 am 
Beginner
Beginner

Joined: Wed Feb 04, 2004 4:54 am
Posts: 25
gavin wrote:
Are you telling me you wrote your application code to depend on net.sf.hibernate.collection.Set? An internal implentation class?


Not now, I was "prototyping" some code and it was working in Hibernate 2 by providing a wrapper extending the Hibernate2 net.sf.collection.Set .

You told me tha hibernate 3 allow the UserCollectionType: I need this functionality. My UserCollectionType should allow me to filter the collection adding something like HQL "where" tokes.

My UserCollectionType should allow me to do this method:
public Iterator iterate(String hqlwherecondition)

My prototype in H2 worked by extending Set that has a similar iterate method (I simply create a proxy that change the my hqlwherecondition in "from this where "+hqlwherecondition and it worked.

_________________
Stefano Bagnara


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 9:31 am 
Beginner
Beginner

Joined: Wed Feb 04, 2004 4:54 am
Posts: 25
gavin wrote:
Are you telling me you wrote your application code to depend on net.sf.hibernate.collection.Set? An internal implentation class?


Notice that I only asked this because I'm almost sure you didn't remove hibernate2 internal functionaly but most probably you refactored and added a more elegant way to do things.

I'm not saying that the missing "query()" method is a problem. I know that the wrapper I created to allow hibernate2 to map my business objects to my relational schema is specific for hibernate2 but what it does matter is that my business objects did not change when I added mapping for hibernate2 and I think/hope I can do something similar with H2 (probably more clean due to the new UserCollectionType that I still have to understand better studying sources)

I'm only looking for a fast hint: I'll dig sources then! :-)

_________________
Stefano Bagnara


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 10:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
why don't you use session.filter() ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 10:24 am 
Beginner
Beginner

Joined: Wed Feb 04, 2004 4:54 am
Posts: 25
michael wrote:
why don't you use session.filter() ?


MMmmm this seems a possible solution!
I thought at sessions filters as a less elegant way but I can write a UserCollectionType that extends the current PersistentSet adding my iterate(String hqlwherecondition) method that would be implemented like:

public Iterator iterate(String hqlwherefilter) {
// PersistentSet already contain the session
return getSession().iterateFilter(this,"from this where "+hqlwherefilter,null);
}

Does it make sense?

_________________
Stefano Bagnara


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 10:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
sounds at least more sensible to me then messing around with internal Hibernate API methods.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 4:17 pm 
Beginner
Beginner

Joined: Wed Feb 04, 2004 4:54 am
Posts: 25
michael wrote:
sounds at least more sensible to me then messing around with internal Hibernate API methods.


Well, I already extend PersistentSet for my needs.
Anyway I implemented the getSession().iterateFilter() and it does work!
Very good!

With H3 my custom collection mappings are really made easy!

_________________
Stefano Bagnara


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.