Difference between commit and flush in Hibernate #2

  • Follow


Hi   Could you please tell me the difference between commit(method ofSession) and flush(method of Transaction) in Hibernate?  I read the book "Java Persistence with hibernate" which referenceto  DAO Pattern for JDK1.5.  The main interface of the pattern is GenericDAO as below:  public interface GenericDAO<T, ID extends Serializable> {         T findById(ID id, boolean lock);         List<T> findAll();         List<T> findByExample(T exampleInstance,         String... excludeProperty);         T makePersistent(T entity);         void makeTransient(T entity);         void flush();         void clear(); } what me me puzzled is why it has no method commit? And when should Icall the method flush and when shuold I commit the transaction if Iuse this pattern? Thanks.
0
Reply shaoanqing (10) 5/28/2007 12:44:44 AM


0 Replies
677 Views

(page loaded in 0.03 seconds)

Similiar Articles:













7/23/2012 11:04:13 AM


Reply: