Re: Tapestry Transactions

2012-05-31 Thread Jonathan Barker
Spring transaction handling makes some things so much easier. For example, on an admin page, I may want to simply save changes to an object by making a call to a makePersistent() method on a DAO. Of course I want that to be committed. That's why I said "makePersistent()" On the other hand, I mi

Re: Tapestry Transactions

2012-05-31 Thread Steve Eynon
This now is all in the realm of Spring so I don't want to say too much... Essentially, it doesn't matter how many 'nested' method calls you make, [with PROPAGATION_REQUIRED] the transaction will rollback to (and commit at) where the annotation was first encountered. See the Spring docs for more:

Re: Tapestry Transactions

2012-05-30 Thread bhorvat
Can you elaborate a bit more the part below Steve Eynon wrote > > unlike T5's @CommitAfter, it doesn't always commit or start a new > transaction. > The T5 annotation always commits when there is not RuntimeException so what does @Transactional annotation does then :S tnx -- View this mes

Re: Tapestry Transactions

2012-05-30 Thread Steve Eynon
Yeah, you can put the Spring @Transactional annotation on any Spring bean / service. Both on the class and its methods. The propagation=Propagation.REQUIRED ensures the code runs inside a transaction but unlike T5's @CommitAfter, it doesn't always commit or start a new transaction. It sounds like

Re: Tapestry Transactions

2012-05-25 Thread bhorvat
So you put your transactional annotation on the DAO, right? The CommitAfter does that for me as well, what I need is to put it on some layer above that has multiple contats to the couple of different DAOs. One that saves one part of the transaction, other that saves another but the should fail or s

Re: Tapestry Transactions

2012-05-25 Thread Steve Eynon
Our dependencies are configured via Ivy: And yes, you need to use the Spring filter in your web.xml because your transactional services will be Spring services - configured in the usual Spring way via the application-context.xml. Example DAO: import org.springframewor

Re: Tapestry Transactions

2012-05-25 Thread bhorvat
Hi Steve, Thanks for posting. Can I ask you to help a bit more :) I have tried adding to pom tapestry-spring but it didn't resolve everything. I was under the impression that tapestry-spring includes everything spring related that is needed. The missing dependencies are related to hibernate impo

Re: Tapestry Transactions

2012-05-23 Thread Steve Eynon
Here is our implementation with Spring 3.1.0 - it lets you use the Spring transaction annotations on your Spring services. First in your module: public static void bind(ServiceBinder binder) { binder.bind(ComponentRequestFilter.class, OpenSpringSessionInViewFilter.class).withSimpleId(); }

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
You are right I wont pollute this mail thread with that anymore, I will try to do a bit more research on one vs the other. But in the mean time if anyone has any suggestion and nice links about spring-transactions and OSIVF please share it will be of great help cheers -- View this message in con

Re: Tapestry Transactions

2012-05-22 Thread Lenny Primak
This is not a topic for this mailing list. There is plenty of other discussions about this elsewhere on the Internet. Suffice it to say that after doing extensive research I came to a confusion that JEE is the way to go for back end services with transactions and tapestry for the web front end.

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
How so? It was my impression that spring is more lightweight then EJB and all that come with it so it is less dependent, am I wrong? tnx -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Transactions-tp5713299p5713341.html Sent from the Tapestry - User mailing list

Re: Tapestry Transactions

2012-05-22 Thread Lenny Primak
I would not use spring in any new projects. Just my opinion though. On May 22, 2012, at 4:59 PM, bhorvat wrote: > I have been reading up a bit on all of this transactions (as I am not that > familiar with it yet :) ), and the last thing that I have read is > http://static.springsource.org/sprin

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
I have been reading up a bit on all of this transactions (as I am not that familiar with it yet :) ), and the last thing that I have read is http://static.springsource.org/spring/docs/2.0.x/reference/transaction.html It seams to me that transactions that offer EJB like CMT are a bit more heavyweig

Re: Tapestry Transactions

2012-05-22 Thread Lenny Primak
Sorry, not what I meant to say at all. You can use CMT (Container-Managed Transactions) The commit happens automatically at the end of your business method and nested and XA transactions are supported via annotations. On May 22, 2012, at 2:41 PM, Lenny Primak wrote: > No. You can use BMP (Bea

Re: Tapestry Transactions

2012-05-22 Thread Lenny Primak
No. You can use BMP (Bean-Managed Persistence). The commit happens automatically at the end of your business method and nested and XA transactions are supported via annotations. On May 22, 2012, at 2:36 PM, bhorvat wrote: > With JEE transaction I would have to handle everything manually? L

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
With JEE transaction I would have to handle everything manually? Like so UserTransaction transaction = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction"); transaction.begin(); EntityManager em = getEntityManager(); Employee employee = em.find(Employee.class, id); employee.s

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
So currently I have a method addItem and removeItem in in there I create couple of entities and remove a couple. Now in those methods I have call to services that only handle single entities (it is just a hibernate CRUD), and this works fine because on the interface of them I have @CommitAfter. H

Re: Tapestry Transactions

2012-05-22 Thread Lenny Primak
How about just using JEE transactions? It's very easy and it's what the whole thing is built for. I am using these with great success in my not-so-small project. On May 22, 2012, at 2:20 PM, bhorvat wrote: > > Thiago H de Paula Figueiredo wrote >> >> On Tue, 22 May 2012 14:19:28 -0300, b

Re: Tapestry Transactions

2012-05-22 Thread Thiago H. de Paula Figueiredo
On Tue, 22 May 2012 15:20:44 -0300, bhorvat wrote: thing is I have tried puting @CommitAfter on methods like that but it didn't work in cases I am trying to delete a bunch of entities. Define 'didn't work'. From a transaction standpoint, updating, inserting and deleting is all the same t

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
Thiago H de Paula Figueiredo wrote > > On Tue, 22 May 2012 14:19:28 -0300, bhorvat > wrote: > >> So tapestry now replaces the need for OSIVF, right? > > tapestry-hibernate and tapestry-jpa solve the same problem as OSIVF but > without using a filter. Instead, it uses perth

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
Hi Howard and tnx for joining in the fun. If you dont mind can you share a bit more light on what do you think in 5.4 will be in regards to this problem. How do you plan to move as you have said it yourself in the direction in which the web is going. Howard Lewis Ship wrote > > However, more

Re: Tapestry Transactions

2012-05-22 Thread Thiago H. de Paula Figueiredo
On Tue, 22 May 2012 14:19:28 -0300, bhorvat wrote: So tapestry now replaces the need for OSIVF, right? tapestry-hibernate and tapestry-jpa solve the same problem as OSIVF but without using a filter. Instead, it uses perthread services. So if I use spring then I dont need this CommitAft

Re: Tapestry Transactions

2012-05-22 Thread Howard Lewis Ship
Tapestry's built-in Hibernate/JPA support is very close to OpenSessionInView. It's lazier, I believe, than Springs. The Session is created on first usage (via the magic of lazy proxies). In any case, the transaction extends to the end of the request, and is then aborted. The challenge is never d

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
OpenSessionInViewFilter has nothing to do with detached entities, it only keeps session open till view is rendered otherwise lazy loading will no work. The filter is trying to solve it by always opening session in every request and closing it at the end. Tapestry hibernate opens session only when

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
> Say that you > load an object and that object has a list of objects in it, and you try to > access the list in the tml page with say the loop component. Now if you > dont > use the OpenSessionInViewFilter you should get an exception > (LazyInitalization). > Yes but only if the session is c

Re: Tapestry Transactions

2012-05-22 Thread Denis Stepanov
OpenSessionInViewFilter has nothing to do with detached entities, it only keeps session open till view is rendered otherwise lazy loading will no work. The filter is trying to solve it by always opening session in every request and closing it at the end. Tapestry hibernate opens session only whe

Re: Tapestry Transactions

2012-05-22 Thread Dragan Sahpaski
On Tue, May 22, 2012 at 3:59 PM, bhorvat wrote: > The thing is I am not sure for what it is used in the first place. Based on > everything that I have read it it seams to me that you use it to keep the > session open until you are done with the rendering of the tml. Yes. The hibernate session (j

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
The thing is I am not sure for what it is used in the first place. Based on everything that I have read it it seams to me that you use it to keep the session open until you are done with the rendering of the tml. Say that you load an object and that object has a list of objects in it, and you try t

Re: Tapestry Transactions

2012-05-22 Thread Dragan Sahpaski
On Tue, May 22, 2012 at 3:34 PM, bhorvat wrote: > Any thoughts on OpenSessionInViewFilter? > Yes. It's an anipattern (search it on google). Don't use it. I avoid detached entities, or keeping them in some serialized form. tapestry's ValueEncoder principle follows the principle of converting cli

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
The blog looks nice but this is not something that I would like to include my self. btw did you try out his example or did you just stumble upon? cheers -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Transactions-tp5713299p5713310.html Sent from the Tapestry - Us

Re: Tapestry Transactions

2012-05-22 Thread bhorvat
Any thoughts on OpenSessionInViewFilter? Is there any tapestry spring transaction example that you know of? cheers -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Transactions-tp5713299p5713309.html Sent from the Tapestry - User mailing list archive at Nabble.co

Re: Tapestry Transactions

2012-05-22 Thread Dragan Sahpaski
Here's a nice blog post form tawus fro extended transactional support http://tawus.wordpress.com/2011/04/23/tapestry-magic-5-advising-services/ Cheers, Dragan Sahpaski On Tue, May 22, 2012 at 1:47 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Tue, 22 May 2012 07:42:08 -03

Re: Tapestry Transactions

2012-05-22 Thread Thiago H. de Paula Figueiredo
On Tue, 22 May 2012 07:42:08 -0300, bhorvat wrote: What is the best way to handle complex transaction in Tapestry? As Tapestry nor Tapestry-IoC don't have support for more complex transaction scenarios, maybe you should consider using Spring or EJB for them. -- Thiago H. de Paula Figu