-->
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.  [ 3 posts ] 
Author Message
 Post subject: session.find passing in mapped object?
PostPosted: Fri Apr 30, 2004 4:52 pm 
Beginner
Beginner

Joined: Tue Sep 02, 2003 12:15 pm
Posts: 33
I was just wondering if this has been thought up. Is there a reason we don't have a session.find(hibernateObject) method in Hibernate? I was thinking that if we stuck to just 1 mapped object at a time, would it be possible to get a new instance of an object, set some parameters and just call session.find(hibernateObject) on it? That would eliminate a very large amount of HQL / SQL code from most systems and allow a pretty robust way to query objects right out of the box.

class Person
{
int weight;
int age;
}

Person person = new Person();
person.setAge(25);

session.find(person);

instead of

final String SQL = "FROM Person as person WHERE person.age = 25";

session.find(SQL);

If it already does this, sorry, and could you point me in the right direction. If this is a feature that sounds interesting and isn't implemented yet, I might be interested in helping out.

Thanks

Nic


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 30, 2004 4:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use the query by example feature of the criteria API. It's in the docs.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 30, 2004 5:18 pm 
Beginner
Beginner

Joined: Tue Sep 02, 2003 12:15 pm
Posts: 33
Thanks. That should work fine. I just missed it.


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