secret

  • Download Gist
gistfile1.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13
public static <M extends Model> M get(Class<M> type, Serializable id) {
Session session = newSession();
Transaction t = session.beginTransaction();
Object model = null;
try {
model = session.get(type, id);
t.commit();
} catch (HibernateException ex) {
t.rollback();
throw ex;
}
return (M) model;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.