public class UserRole implements java.io.Serializable {
/** */
private long id;
/** */
private UserAcegi userAcegi;
/**
*
*/
public UserRole() {
}
/**
*
* @param idVar -
*/
public UserRole(final int idVar) {
this.id = idVar;
}
/**
*
* @param idVar -
* @param roleVar -
* @param userAcegiVar -
*/
public UserRole(final int idVar, final UserAcegi userAcegiVar) {
this.id = idVar;
this.userAcegi = userAcegiVar;
}
/**
*
* @return long
*/
public long getId() {
return this.id;
}
/**
*
* @param idVar -
*/
public void setId(final long idVar) {
this.id = idVar;
}
/**
*
* @return UserAcegi
*/
public UserAcegi getuserAcegi() {
return this.userAcegi;
}
/**
*
* @param userAcegiVar -
*/
public void setuserAcegi(final UserAcegi userAcegiVar) {
this.userAcegi = userAcegiVar;
}
}
<hibernate-mapping>
<class name="UserRole" table="userrole" >
<id name="id" type="long">
<column name="id" />
<generator class="native" />
</id>
<many-to-one name="userAcegi" class="UserAcegi" fetch="select">
<column name="userid" />
</many-to-one>
</class>
</hibernate-mapping>
======
Criteria criteria = ThreadSessionManager.getCurrentThreadSession().currentAccegiSession().createCriteria(UserRole.class);
criteria.add(Restrictions.eq("userAccegi.id", "7300765"));
final List objList = criteria.list();
return objList;