I have a scenario service layer is transactional, where i can only commit after done trandaction. i simplified it into like below.
begin transaction
for(loop){
getHibernateTemplate().save(object);
getHibernateTemplate().get(object_by_key); //cannot get object by object_by_key because "object" is not commit into database until entire for(loop) completed.
}
end transaction. commit();
i try to put getHibernateTemplate().flush(), after save() and able to see "insert" in show_sql. but the record is not showing inside database. how to force write to database after each save() rather than wait for commit like above ?