You've got a lot of options... but based on what you've showed...
check out http://www.springframework.org/docs/reference/transaction.html and then go down to section 9.5 for the declarative spring transactions. The way you've given is spring a spring 1.2 way... Michael Wiles Java Developer paulie4694 <[EMAIL PROTECTED]> Sent by: [email protected] 2007/10/18 12:10 PM Please respond to [email protected] To CTJUG Forum <[email protected]> cc Subject [CTJUG Forum] Re: Spring transations Hi All. More info? In my service layer, I have my transactionManager declaration. <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="userService" parent="txProxyTemplate"> <property name="target"> <bean class="za.co.gvwwe.services.impl.UserServiceImpl"> <property name="userDAO"><ref bean="userDAO"/></ property> </bean> </property> </bean> <bean id="propertyService" parent="txProxyTemplate"> <property name="target"> <bean class="za.co.gvwwe.services.impl.PropertyServiceImpl"> <property name="dao"><ref bean="dao"/></property> </bean> </property> </bean> In my action I have the following. //new transaction created User user = userService.findUserById(4); //commit happens //new transaction String xml = propertyService.createXML(user); //in the propertyService i do the following dao.getIdentifier(user); This is when I get the error user not associated with the current session How do i wire spring that it only create one transaction/session for both service calls? Any help would be greatly appreciated. Thanks. Paulie. On Oct 17, 4:28 pm, paulie4694 <[EMAIL PROTECTED]> wrote: > Hi All. > > I have a Web application that uses struts2, spring, hibernate and > mysql? > > My question is, doe anyone know how to implement a hibernate-session- > per-request type transaction management. > > I have my struts2 action, which does a call to 2 different services. > The second call needs to use data retrieved in the first call. > > It does then give me an exception, which basically says the object > retrieved in the first call is not associated with the current > session? > > Hope you understand. > Thanks. > > Paulie. Disclaimer Sanlam Life Insurance Limited - Reg No 1998/021121/06 - Licensed Financial Services Provider Disclaimer and Directors Alternatively, send a blank email to Disclaimer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CTJUG Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/CTJUG-Forum For the ctjug home page see http://www.ctjug.org.za -~----------~----~----~----~------~----~------~--~---
