Spent today working on linking new policies to existing customers. Such an action requires the update of three sperate tables.
While under a traditional style web application tranactional such work would ideally be carried out by a trigger.
However, as we are using hibernate & spring there is an altogether different way of handling this situation.
The standard DAO bean class reference is changed to utlise the springframework interceptor and the DAO bean becomes a proxy to the DAOTarget. When a call to a method defined in transactionAttributes is made on the proxy, the proxy uses the transactionManager to set up the transaction and calls the appropriate method on the target. If the traget method thorws an exception, the proxy instructs the transaction manager to roll back the active transaction else the transaction is committed.
The beauty of this implemention I see is that there is no change required to the DAO code to “setup” a transaction you just write the code as if there was no transaction.
code snippet:
<bean id=“policyDAO” class=“org.springframework.transaction.interceptor.TransactionProxyFactoryBean”>
<property name=“transactionManager”><ref bean=“transactionManager”/></property>
<property name=“target”><ref local=“policyDAOTarget”/></property>
<property name=“transactionAttributes”>
<props>
<prop key=“save”>ISOLATION_SERIALIZABLE</prop>
</props>
</property>
</bean>
<bean id=“policyDAOTarget” class=“com.zeninvent.dmib.db.hibernate.HibernatePolicyDAO”>
<property name=“hibernateTemplate”><ref bean=“hibernateTemplate”/></property>
</bean>
It looks nice & simple now but it’s taken me a day to figure out with a log file 1763784 lines long..thats 34 mb… Thank you tomcat…
HD14 Tomorrow – Agenda
http://gaffneykev.no-ip.info/ca400blog/Docs/Meeting%20HD14%20Agenda.doc
Some screenshots of the latest updates to the GUI after DM05:
http://gaffneykev.no-ip.info/ca400blog/Docs/main.JPG
http://gaffneykev.no-ip.info/ca400blog/Docs/policy.JPG
David today also made good progress on hooking into best advices quotation system after they setup a test account for us.
My Spring book proved pretty useful on helping with the transactions and then a couple of links on the net gave me some pointers for making hibernate “Spring” off
the same sheet..
http://www.shoesobjects.com/blog/2004/11/21/1101083542880.html
http://www.onjava.com/pub/a/onjava/2005/05/18/swingxactions.html?page=1
http://www.zabada.com/technology/Wiki.jsp?page=SpringAndHibernate
http://forum.springframework.org/showthread.php?t=15875
We are up to 26 issues now in the issueTracker with 9 active
http://gaffneykev.no-ip.info:82/IssueTracker