-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: petclinic transactions without Web framework.
PostPosted: Thu Nov 20, 2003 12:22 pm 
Beginner
Beginner

Joined: Tue Nov 18, 2003 10:16 am
Posts: 33
Location: Cluj-Napoca, Romania
I have beed doing some tests on Petclinic application in order to see how transaction management works.

In [b]HibernateClinic [/b]class , method [b]loadPet[/b] I've inserted 2 calls : one to [b]storeOwner()[/b] and second to [b]storeVisit()[/b].
The method [b]storeVisit[/b] is throwing an exception and due to this transaction is rolledback.
When I have been tested this code change throught petclinic web interface everything works correct: the transaction is rolledback.

Then, I have created my own jsp page for test, in wich I get an reference to Clinic Bean from application context (ctx.getBean("bean_id")).
When I am calling the same [b]loadPet[/b] method, the transaction is not rolled back and the owner remains inserted in the database.

I presume that the interceptor proxy is not called from my jsp page, because the call is treated as 2 transactions individually.

How can I make my own jsp page to work without using the MVC provided by Spring?

Many Thanks, Florin Marcus.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 4:13 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
Which bean have you fetched in your JSP? It needs to be the transactional proxy, not the target business object: i.e. "clinic", not "clinicTarget". Then the transactional behavior should be exactly the same as in the standard sample with Spring's web MVC, because that's exactly what the controllers there do too.

Spring's transaction management is by no means tied to or influenced by Spring's web MVC division. They are completely different aspects of the framework that can be applied individually.

Juergen


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 6:10 am 
Beginner
Beginner

Joined: Tue Nov 18, 2003 10:16 am
Posts: 33
Location: Cluj-Napoca, Romania
Yes, many thanks. I have finally understand the meaning of proxy.
For my Service Object I didn't had an inteterface to implement.
Now it works.

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 6:24 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
florinmarcus wrote:
For my Service Object I didn't had an inteterface to implement.


FYI, you don't need to implement an interface for proxying: TransactionProxyFactoryBean has a property "proxyInterfacesOnly" that can be set to false for proxying the full class, no matter if it implements a business interface or not. This is not the default as accessing business services via interfaces only is recommended. Furthermore, proxying the full class requires CGLIB on the class path; proxying an interface just requires J2SE 1.3.

Juergen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.