Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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);
} catch (HibernateException ex) {
throw ex;
return (M) model;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment