I have code like these:
Code:
if (user.getPasswd().equals(passwd)) {
user.setStatus("Login");
System.out.println("1-------------");
officerDAO.update(user);
}
SysLog sLog = new SysLog();
sLog.setOfficerCode(user.getOfficerCode());
sLog.setDetail("Test system log.");
System.out.println("2-------------");
sysLogDAO.save(sLog);
And output is :
Code:
1-------------
Hibernate: update Officer set officerCode=?, name=?, password=?, status=? where oid=?
2-------------
Hibernate: insert into SysLog (operDate, officerCode, detail, type, eid) values (?, ?, ?, ?, ?)
that is correct.
but when I declare transaction in applicationContext-hibernate.xml like:
Code:
<bean id="loginService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="myTransactionManager"/></property>
<property name="target"><ref local="loginTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED,readOnly,-officerException</prop>
<prop key="login*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
the output become:
Code:
1-------------
2-------------
Hibernate: insert into SysLog (operDate, officerCode, detail, type, eid) values (?, ?, ?, ?, ?)
Hibernate: update Officer set officerCode=?, name=?, password=?, status=? where oid=?
WHY ?? the SQL execute order changed too.