@SuppressWarnings("unchecked")
public AcademicDelete AcademicInformation(long academicInfoId) {
s = sf.openSession();
Transaction t = null;
try {
t = s.beginTransaction();
Academic deleteInfo = (Academic) s.load(Academic.class, academicInfoId);
if (deleteInfo != null) {
s.delete(deleteInfo);
}
t.commit();
return deleteInfo;
} catch (Throwable ex) {
//Log the Exception
t.rollback();
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
} finally {
s.close();
sf.close();
}
}
public AcademicDelete AcademicInformation(long academicInfoId) {
s = sf.openSession();
Transaction t = null;
try {
t = s.beginTransaction();
Academic deleteInfo = (Academic) s.load(Academic.class, academicInfoId);
if (deleteInfo != null) {
s.delete(deleteInfo);
}
t.commit();
return deleteInfo;
} catch (Throwable ex) {
//Log the Exception
t.rollback();
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
} finally {
s.close();
sf.close();
}
}
No comments:
Post a Comment