コード例 #1
0
 @Override
 public RoundTrip select(Integer pk) {
   SessionFactory factory = SessionFactory.getSessionFactory();
   Session s = factory.getSession();
   RoundTrip l = (RoundTrip) s.get(RoundTrip.class, pk);
   return l;
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
 @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;
 }