letsbedecent
asked on
Hibernate Query By Example
Hello,
can anyone tell me where i can find the documentation on this ??
I searched for it , but couldnt find.
Thanks.
can anyone tell me where i can find the documentation on this ??
I searched for it , but couldnt find.
Thanks.
ASKER
Hey,
Its not HQL i am asking about. Its Hibernate QBE ( a part of hibernate QBC). I found documentation on QBC, but not QBE... thats what i am looking for.
Thank you.
Its not HQL i am asking about. Its Hibernate QBE ( a part of hibernate QBC). I found documentation on QBC, but not QBE... thats what i am looking for.
Thank you.
Or do you mean this: http://www.hibernate.org/5.html?
ASKER
nope
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
User exampleUser = new User();
exampleUser.setFirstname(" Max");
Criteria criteria = session.createCriteria(Use r.class);
criteria.add( Example.create(exampleUser ) );
List result = criteria.list();
exampleUser.setFirstname("
Criteria criteria = session.createCriteria(Use
criteria.add( Example.create(exampleUser
List result = criteria.list();
ASKER
Thank you.,
what if the exampleUser has a mapping to Office object. (many to one). and now i want to get all users within the office of "Experts Exchange" having a name "mike"
??
Thank you.
what if the exampleUser has a mapping to Office object. (many to one). and now i want to get all users within the office of "Experts Exchange" having a name "mike"
??
Thank you.
u will find your solution here
http://nhibernate.sourceforge.net/h2.0.3-docs/reference/html/query-language.html
http://nhibernate.sourceforge.net/h2.0.3-docs/reference/html/query-language.html
ASKER
I dont want to use HQL.
i want to use the hibernates capability of retrieving records by criteria / example.
i want to use the hibernates capability of retrieving records by criteria / example.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Where do you specify the {alias} name ??
{alias} will be replaced with the name of the table (hibernta does it for you)
see: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/criterion/Restrictions.html#sqlRestriction(java.lang.String)
see: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/criterion/Restrictions.html#sqlRestriction(java.lang.String)
:-)
Good luck!
Good luck!
http://nhibernate.sourceforge.net/h2.0.3-docs/reference/html/worked-example.html