@Override public RoundTrip select(Integer pk) { SessionFactory factory = SessionFactory.getSessionFactory(); Session s = factory.getSession(); RoundTrip l = (RoundTrip) s.get(RoundTrip.class, pk); return l; }
@SuppressWarnings("unchecked") @Override public List<RoundTrip> selectAll() { SessionFactory factory = SessionFactory.getSessionFactory(); Session s = factory.getSession(); List<RoundTrip> l = new ArrayList<RoundTrip>(); l = s.createCriteria(RoundTrip.class).list(); return l; }
@Override public RoundTrip update(RoundTrip roundtrip) { SessionFactory factory = SessionFactory.getSessionFactory(); Session s = factory.getSession(); Transaction transaction = s.beginTransaction(); s.update(roundtrip); transaction.commit(); s.flush(); RoundTrip resultRoundTrip = (RoundTrip) s.get(RoundTrip.class, roundtrip.getRoundTripID()); s.close(); return resultRoundTrip; }