Take a Scenario, We have two Entities: Login and AppDetails. Of these Entities AppDetails has a foreign key login references the loginId column on Login Entity. So how could we query the AppDetails with a certain loginId ?
public class AppDetails{
private Login login; // foreign key
----
}
public class Login
{
private Integer loginId; // primary key
----
}
Here is the query :
session.createCriteria(AppDetails.class) .add(Restrictions.eq("login.loginId", loginId ));
0 comments:
Post a Comment