am new to Hibernate. I have two tables named "User" and "Details". These two tables are mapped as " one-to-many ". The mapping process is given as follow.
@Entity
public class User {
private int id;
private Strng name;
@OneToMany(mappedBy ="user" )
private Collection<Details> details;//= new ArrayList<Details>();
....getters and setters.....
}
and Details class is
@Entity
public class Details{
private int id;
private Strng address;
private String deleted;
}
And this one to many relation works fine..
Now i want to retrieve the data from " details " table of particular record in " user " table with an additional condition ie, "deleted " field is equal to the string "NO".
For this requirement hibernate, how can i achieve this one.
Filters or criteria or some one else ,, which one is the best way to solve my problem, with out break the relation.
I mean , with the help of relations we simple get all the data at single line of code, like " user_obj.getDetails()" . In the same way we can simple get the data from the data base with extra conditions with less code.
Thank u to all,, in advance.......