I know you create a nested Criteria for related objects. Not sure if
it's the same for embedded objects but you could try.
getSession().createCriteria(User.class).createCriteria("address").add
(Restrictions.eq("city",paramValue). etc
If you are chaining be sure to add the nested criteria last or your
additional Restrictions will try to find properties in the child
Criteria.
Session-timeout in web.XML
On Aug 10, 2009, at 12:29 PM, foward <fow...@gmail.com> wrote:
Hello everyone!
I have two questions that I would be very happy if you can help me...
First I want to do a criteria query where I want to ask the fields
embedded
in Address Class... I tried to do the following...but it isn't
works...
public List<User> getUsersByCriteria(String username, String
firstName,
String lastName, String email, String lugarTrabajo, String comuna,
String
city, String region) {
Criteria criteria = getSession().createCriteria(User.class);
criteria.setResultTransformer
(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
if (!username.isEmpty()) {
criteria.add(Restrictions.eq("username", username));
}
if (!firstName.isEmpty()) {
criteria.add(Restrictions.like("firstName", "%"+firstName
+"%"));
}
if (!lastName.isEmpty()) {
criteria.add(Restrictions.like("lastName", "%"+lastName
+"%"));
}
if (!email.isEmpty()){
criteria.add(Restrictions.eq("lugarTrabajo",
lugarTrabajo));
}
if (!comuna.isEmpty()){
criteria.add(Restrictions.eq("address.comuna", comuna));
}
if (!city.isEmpty()){
criteria.add(Restrictions.eq("address.city", city));
}
if (!region.isEmpty()){
criteria.add(Restrictions.eq("address.region", region));
}
return criteria.list();
}
And the other question is where is set the session Time for it in the
appfuse? ...
Thank you in Advance
Best Regards
--
View this message in context:
http://www.nabble.com/Criteria-Query-Address-%28Embedded%29-and-Extend-Session-Time-tp24905915s2369p24905915.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net