find code examples.
------ Solution --------------------------------------------
a List list = session.createQuery ("from table as t where t.parameter =?"). setParameter (0, "parameter"). list (); kind of statement ?
------ For reference only -------------------------------------- -
positive solutions upstairs I also learned
------ For reference only ---------------------- -----------------
form User
enough
if not the entity
SQLQuery query = getSession (). createSQLQuery (hql). addEntity (clazz);
------ For reference only ------------- --------------------------
this better be loaded up
------ For reference only - -------------------------------------
in JPA the JPQL where you can so that I do not know where okay hql
String sql = "select new com.cl.bean.SimplePerson (p.name, p.sex) from Person p where p.id = ? 1 " ;
------ For reference only ---------------------------------- -----
Oh, I have this problem solved independently .
My approach is
List
if (result.size () == 0) return null
else return result.get (0);
没有评论:
发表评论