S
santax
Hi
Could you please tell me the difference between commit(method of
Session) and flush(method of Transaction) in Hibernate?
I read the book "Java Persistence with hibernate" which reference
to 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 I
call the method flush and when shuold I commit the transaction if I
use this pattern?
Thanks.
Could you please tell me the difference between commit(method of
Session) and flush(method of Transaction) in Hibernate?
I read the book "Java Persistence with hibernate" which reference
to 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 I
call the method flush and when shuold I commit the transaction if I
use this pattern?
Thanks.