Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org.hibernate.Session session = ...;
- long id = 1;
- A obj = session.load(A.class, id);
- org.hibernate.Session session = ...;
- long id = 1;
- boolean exists = session.exists(A.class, id);
- if(exists){
- // do smth.....
- }
- public Object get(Class clazz,
- Serializable id)
- throws HibernateException
- public Boolean exists (DTOAny instance) {
- Query query = getSession().
- createQuery("select 1 from DTOAny t where t.key = :key");
- query.setString("key", instance.getKey() );
- return (query.uniqueResult() != null);
- }
Add Comment
Please, Sign In to add comment