[jboss-user] [JBoss Seam] - Re: Transaction demarcation problem
Probably not a topic for the Seam forum, try the EJB3 forum. And, as a courtesy to your readers, please try to format you post and code snippets in more readable way. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4122725#4122725 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4122725 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction demarcation on EJB3/Seam methods
HI, I'd like using this kind of annotation: @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW). Consider that I have this situation: 1)I call a first method of ejb3/seam marked with the above annotation. 2)Inside that method I call another method that I want starts in a different transaction and then I mark also this method with the same annotation. The problem is that there is always a unique transaction and the commit operation is carried out at the end of first method. Thanks a lot Bye View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4091417#4091417 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4091417 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction demarcation on EJB3/Seam methods
What kind of transaction demarcation/ annotation do you want to use? Doesn't EJB3 by default already demarcate transaction before and after the method is invoked? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4091324#4091324 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4091324 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
When you call a method from within a session bean on the same bean, you have to call it using the interface (if you want transaction attributes to work, and any other interceptors). You are probably calling on 'this' at the moment, which means the container doesn't get a chance to do its magic. You can use the SessionContext (ejb api) to get the interface, and make the call on that. The sessioncontext can be injected (if i recall correctly, put @Resource at the field). Then, getBusinessObject should do the trick. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4055018#4055018 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4055018 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Toni, I am trying to do exactly what you describe but am having no luck. Could you possibly give a small example of how you achieved the transactions? many thanks, Dustin View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4054926#4054926 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4054926 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Hi, I'm still trying to figure out how to span several transactions within the scope of one web request/response. I guess using a TransactionalSeamPhaseListener is not an option, because it always starts a transaction at the beginning and end of the request ie response respectively. So I guess I have to use a SeamPhaseListener and then start the transactions by myself?! But I think using the SeamPhaseListener will give me LIEs. Is it possible in Seam at all to span several transactions within one http request/response cyle??? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043075#4043075 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043075 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Transaction != Persistence Context As long as there is a persistence context, you can lazy load stuff. Just use the UserTransaction API or EJB3 transaction annotations to set transaction boundaries. The RENDER RESPONSE phase, and any data access not in the INVOKE APPLICATION PHASE (where your custom transaction assembly would most likely apply) is then executing effectively in auto-commit mode. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043084#4043084 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043084 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
By the way, you can always use the TransactionalSeamPhaseListener and @TransactionAttribute(REQUIRES_NEW) to suspend the existing transaction during a particular method call in INVOKE APPLICATION. Your method then executes in a new transaction context - which is committed when the method returns. As long as your are using a Seam-managed persistence context [EMAIL PROTECTED] EntityManager, this should work fine even if your method calls other transactional methods that use the entity manager. I wouldn't try this with @PersistenceContext, the rules for propagation are complicated because they are tightly bound to the transaction propagation. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043085#4043085 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043085 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
[EMAIL PROTECTED] wrote : By the way, you can always use the TransactionalSeamPhaseListener and @TransactionAttribute(REQUIRES_NEW) to suspend the existing transaction during a particular method call in INVOKE APPLICATION. Your method then executes in a new transaction context - which is committed when the method returns. | Have you actually tried that? I'm asking because it definitely does not work with my application (Seam 1.1, JBoss 4.0.5). I also recall that somehwere Gavin notes that in particular this type of transaction attribute is not supported by the @Transactional notation, which I guess you would have to use in Seam instead of @TransactionAttribute?! http://docs.jboss.com/seam/1.1.1.GA/api/org/jboss/seam/annotations/TransactionPropagationType.html View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043088#4043088 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043088 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
@Transactional is a hint for JavaBeans! It is not used if you have EJB 3.0 components. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043104#4043104 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043104 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
So you are saying that @Transactional should only be used on Seam components, which are missing the tags @Stateless or @Stateful? And that seam components which are tagged with @Stateless or @Stateful should refer/use @TransactionAttribute instead ? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043119#4043119 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043119 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Exactly View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043126#4043126 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043126 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Well thank you for clarifying this! I was already wondering why seam would introduce an extra transaction annotation, which lacks some of the EJB3 transactional attributes. anonymous wrote : | By the way, you can always use the TransactionalSeamPhaseListener and @TransactionAttribute(REQUIRES_NEW) to suspend the existing transaction during a particular method call in INVOKE APPLICATION. Your method then executes in a new transaction context - which is committed when the method returns. | | As long as your are using a Seam-managed persistence context [EMAIL PROTECTED] EntityManager, this should work fine even if your method calls other transactional methods that use the entity manager. | However, I still have to say that tagging my method with @TransactionAttribute(REQUIRES_NEW) and using a TransactionalSeamPhaseListener does not work: All the data is written at the very end of the invocation, which takes about 20 minutes. Do you have any idea why your suggestion does/might not work in my szenario, which is: User klicks a link, which calls an action method of a SFSB (statefull), which then calls a SLSB (stateless), which start inserting many entities by repeately calling local methods of which some again call another SLSB's method. BTW: In another forum thread somebody told me to use @TransactionTimeout, when I ran into a TransactionTimeout exception, which occurred because the process lasts for 20 minutes. I tried that without any luck. I had to increase the Timeout in jta-service.xml in order for this single transaction to complete at all. Because the suggested annotation did not extend the Timeout and because your suggestions does not work for me either, I get the feeling that those EJB3 annotations are not working with/on seam components. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043146#4043146 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043146 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
You need to enable logging for the transaction service in your server and watch when transactions are created and when they are committed. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043154#4043154 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043154 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
How and where ca I turn this on? I noticed something very interesing so: I used @TransactionAttribute(TransactionAttributeType.NEVER) on the first call to the SLSB (stateless) and the transaction gets stopped! In the logfile I see: 007-05-04 14:56:08,090 ERROR [org.jboss.ejb.txtimer.TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.IllegalStateException: Transaction present on server in Never call However, if I place the annotation on the method, which actually creates a single entity and gets called by, then nothing happens. So this explains why placing @TransactionAttribute(REQUIRES_NEW) on it does not work either! The big question now is why? Do you have idea? Here once more the flow of execution: 1. User clicks button 2. userSchedule() gets called on SFSB1 3. scheduleMessages() gets called on SLSB1 by SFSB1 4. scheduleMessage() gets called by SLSB1 many times Placing @TransactionAttribute(TransactionAttributeType.NEVER) on scheduleMessages() stops the flow of execution. However, placing it on scheduleMessage() has no effect!! Why is that? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043164#4043164 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043164 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
anonymous wrote : 3. scheduleMessages() gets called on SLSB1 by SFSB1 Maybe because it's a re-entrant call? I don't know, ask on the EJB3 forum. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043176#4043176 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043176 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Oh, it's not re-entrant, its sLsb called by sFsb. Anyway, enable logging (no, I don't search the Wiki for you) and don't guess. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043177#4043177 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043177 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Hi Christian, thanks for you help. That seems to be the reason. I introduced another session bean and now its working! View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043179#4043179 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043179 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Well my last post actually refers not to your last post, but the one before. What you assume in your last post I thought before and made all the session beans stateful - but that did not help either. It's seems to be that on reentrant calls the annotations are ignored. By introducing another SFSB I made the call non reentrant and now it works! Thanks again! View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043182#4043182 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043182 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
What do you need is user transactions. | import javax.ejb.TransactionManagement; | import javax.ejb.TransactionManagementType; | | | @TransactionManagement(TransactionManagementType.BEAN) | public class Q... | @In | private EntityManager entityManager; | @Resource | public UserTransaction utx; | | .. | utx.begin(); | utx.commit(); | utx.rollback(); | .. | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4041617#4041617 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4041617 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Transaction Demarcation
Check out @TransactionAttribute in the EJB3 spec. http://trailblazer.demo.jboss.com/EJB3Trail/services/transaction/ If you're not using EJB3 Hibernate might have it's own transaction annotations but I'm not aware of them. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4041482#4041482 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4041482 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user