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
|