List of usage examples for javax.persistence TypedQuery setParameter
TypedQuery<X> setParameter(int position, Object value);
From source file:de.lava.marvin.whaosleaguepersistence.dao.impl.PlayerDaoImpl.java
@Override public long getCountAllWinsForPlayerInLeague(Player p, League l) { TypedQuery<Long> query = entityManager.createNamedQuery("countAllWinsForPlayerInLeague", Long.class); query.setParameter("player", p); query.setParameter("league", l); return query.getSingleResult(); }
From source file:com.simplecrud.dao.UserInfoDao.java
/** * * @param Id// www. ja v a2 s . c o m * @return */ public Object getUserNamebyId(Long Id) { TypedQuery<NewMember> q = em.createQuery("SELECT n.username FROM NewMember n WHERE n.id = :Id", NewMember.class); q.setParameter("Id", Id); return q.getSingleResult(); }
From source file:com.simplecrud.dao.UserInfoDao.java
/** * * @param Id//from ww w .j a v a 2s.co m * @return */ public Object getUserPasswordbyId(Long Id) { TypedQuery<NewMember> q = em.createQuery("SELECT n.password FROM NewMember n WHERE n.id = :Id", NewMember.class); q.setParameter("Id", Id); return q.getSingleResult(); }
From source file:com.simplecrud.dao.UserInfoDao.java
/** * * @param Id// ww w. j a v a 2 s . co m * @return */ public Object getUserRolebyId(Long Id) { TypedQuery<NewMember> q = em.createQuery("SELECT n.has_role FROM NewMember n WHERE n.id = :Id", NewMember.class); q.setParameter("Id", Id); return q.getSingleResult(); }
From source file:de.lava.marvin.whaosleaguepersistence.dao.impl.PlayerDaoImpl.java
@Override public long getCountAllLosesForPlayerInLeague(Player p, League l) { TypedQuery<Long> query = entityManager.createNamedQuery("countAllLosesForPlayerInLeague", Long.class); query.setParameter("player", p); query.setParameter("league", l); return query.getSingleResult(); }
From source file:com.ushahidi.swiftriver.core.api.dao.impl.JpaAccountDao.java
public Account findByUsernameOrEmail(String username) { String qlString = "SELECT a FROM Account a JOIN a.owner o " + "WHERE o.username = :username OR o.email = :email"; Account account = null;//w w w . java 2s . c om try { TypedQuery<Account> query = em.createQuery(qlString, Account.class); query.setParameter("username", username); query.setParameter("email", username); account = query.getSingleResult(); } catch (NoResultException e) { logger.info("Account associated with {} not found", username); } return account; }
From source file:de.lava.marvin.whaosleaguepersistence.dao.impl.PlayerDaoImpl.java
@Override public long getCountAllUnrankedMatchesForPlayer(Player p) { TypedQuery<Long> query = entityManager.createNamedQuery("countAllUnrankedMatchesForPlayer", Long.class); query.setParameter("player", p); return query.getSingleResult(); }
From source file:de.lava.marvin.whaosleaguepersistence.dao.impl.PlayerDaoImpl.java
@Override public long getCountAllMatchesForPlayerInLeague(Player p, League l) { TypedQuery<Long> query = entityManager.createNamedQuery("countAllMatchesForPlayerInLeague", Long.class); query.setParameter("player", p); query.setParameter("league", l); return query.getSingleResult(); }
From source file:com.simplecrud.dao.UserInfoDao.java
/** * * @param username//from w w w. j a va2 s .co m * @return */ public Object getUserInfo(String username) { TypedQuery<NewMember> q = em.createQuery("SELECT n FROM NewMember n WHERE n.username = :username", NewMember.class); q.setParameter("username", username); return q.getSingleResult(); }
From source file:com.simplecrud.dao.UserInfoDao.java
/** * * @param Id/*from w w w. ja v a 2 s.c o m*/ * @return */ public Object getUserSigningDatebyId(Long Id) { TypedQuery<NewMember> q = em.createQuery("SELECT n.signingDate FROM NewMember n WHERE n.id = :Id", NewMember.class); q.setParameter("Id", Id); return q.getSingleResult(); }