Example usage for org.hibernate Query setEntity

List of usage examples for org.hibernate Query setEntity

Introduction

In this page you can find the example usage for org.hibernate Query setEntity.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
Query<R> setEntity(String name, Object val);

Source Link

Document

Bind an instance of a mapped persistent class to a named query parameter.

Usage

From source file:com.appeligo.search.entity.Favorite.java

License:Apache License

public static List<Favorite> getFavoriteEpisodes(User user) {
    Permissions.checkUser(user);/*from  www.j  av a  2 s . com*/
    Session session = getSession();
    Query query = session.getNamedQuery("Favorite.getFavoriteEpisodes");
    query.setEntity("user", user);
    return query.list();
}

From source file:com.appeligo.search.entity.Favorite.java

License:Apache License

public static Favorite findFavoriteProgram(User user, String programId) {
    Permissions.checkUser(user);//  w  ww  .  j av  a2s.c o m
    Session session = getSession();
    Query query = session.getNamedQuery("Favorite.getProgram");
    query.setEntity("user", user);
    query.setString("programId", programId);
    return (Favorite) query.uniqueResult();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

public static Friend findByEmail(User user, String email) {
    Session session = getSession();//  w w  w  .ja  v a  2 s  . co m
    Query query = session.getNamedQuery("Friend.getByEmail");
    query.setString("email", email);
    query.setEntity("user", user);
    return (Friend) query.uniqueResult();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

public static Friend findByInvitee(long id, User user) {
    Session session = getSession();//from   w w  w.jav a 2  s .c o m
    Query query = session.getNamedQuery("Friend.getByInvitee");
    query.setLong("id", id);
    query.setEntity("user", user);
    return (Friend) query.uniqueResult();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

public static Friend findByInviter(long id, User user) {
    Session session = getSession();/*from w w w  .j  ava2s .com*/
    Query query = session.getNamedQuery("Friend.getByInviter");
    query.setLong("id", id);
    query.setEntity("user", user);
    return (Friend) query.uniqueResult();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

@SuppressWarnings("unchecked")
public static List<Friend> findFriends(User user) {
    Session session = getSession();/*from   w  w w.  j a  v a  2 s  .  c o m*/
    Query query = session.getNamedQuery("Friend.getFriends");
    query.setEntity("user", user);
    return query.list();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

@SuppressWarnings("unchecked")
public static List<Friend> findInvites(User user) {
    Session session = getSession();/*w  w  w  . j av  a 2  s .co  m*/
    Query query = session.getNamedQuery("Friend.getInvites");
    query.setString("email", user.getPrimaryEmail());
    query.setEntity("invitee", user);
    return query.list();
}

From source file:com.appeligo.search.entity.Friend.java

License:Apache License

public static Friend findByUser(User user, User friend) {
    Session session = getSession();//from  w ww.  ja va 2s .co  m
    Query query = session.getNamedQuery("Friend.getByUser");
    query.setEntity("inviter", user);
    query.setEntity("invitee", friend);
    return (Friend) query.uniqueResult();
}

From source file:com.appeligo.search.entity.Rating.java

License:Apache License

public static List<Rating> findByUser(User user) {
    Permissions.checkUser(user);//  w  w w . j a v a2 s  .com
    Session session = getSession();
    Query query = session.getNamedQuery("Rating.getUserRatings");
    query.setEntity("user", user);
    return query.list();
}

From source file:com.appeligo.search.entity.Rating.java

License:Apache License

public static Rating findProgramRating(User user, String programId) {
    Permissions.checkUser(user);//from w  w  w .  j a  v  a2  s . co m
    Session session = getSession();
    Query query = session.getNamedQuery("Rating.getProgram");
    query.setEntity("user", user);
    query.setString("programId", programId);
    return (Rating) query.uniqueResult();
}