[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
I tried calling SessionContext.getBusinessObject() and also SessionContext.getInvokedBusinessInterface() from a SLSB method. However, I get an IllegalStateException - "Not Implemented". (aside: any reason to not to call getInvokedBusinessInterface() vs getBusinessObject()? It seems simpler to not have to pass in the interface) @Stateless | public class FooBean implements FooLocal { | | @Resource SessionContext ctx; | public static Logger log = Logger.getLogger( "FooBean" ); | | public void doSomething() { | log.info( "doSomething: enter"); | | //Foo thisFoo = (Foo)ctx.getBusinessObject( FooLocal.class ); | Foo thisFoo = (Foo)ctx.getInvokedBusinessInterface(); | | log.info( "got business interface: " + thisFoo ); | } | } I see the enter log message, but nothing after. I guess there are two choices - either I'm not using this correctly or it's really not implemented. Bill - should this work w/ RC7? If not, would we expect this for a GA release of EJB3? As to using the JBoss AOP @Tx mixed w/ EJB3 syntax, I don't think I can sell that to our group. It seems messy to adopt EJB3 only to sprinkle in a proprietary syntax to get the desired to our group. Thanks, -Dan View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949688#3949688 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949688 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
Not having looked at the actual implementation for injection, I'd guess that | @EJB | private SameEJB same; | I would expect that it doesn't give you a self referencing proxy. It probably at best give an error that it's not legal At worst give you infinite recursion as it would be creating new instances to inject and new instances for those injected beans to have more injections, etc. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949639#3949639 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949639 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
Thanks for the discussion - it's been very helpful coming up to speed on this... In the case of a same EJB call, is there any difference between doing A) @EJB SameEJB same; vs: B) @Resource SessionContext ctx; ... SameEJB same = ctx.getBusinessObject(); I'm guessing in B) you get a local if you're working w/ a local intf, vice versa. How does @EJB deal w/ local deal w/ that? -Dan View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949624#3949624 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949624 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
I didn't even realize you could get the proxy object from the context, might have been a better solution. The @Tx stuff works, and I've been using the JBoss AOP stuff for a few years in production, so I don't really worry about that (aside from the 1/3 increase in deploy time, but that's no biggie) As for adding a jboss specific hack, doing that would kind of suck, think about all the places you do things like: | Logger log = Logger.getLogger(getClass()); | You'd end up with a funky subclass in your log files, since the only way to make self references adhear to the annotations would be to generate a subclass or use LoadTimeWeaving. (I believe) View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949520#3949520 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949520 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
Like dbudworth said, you can use the AOP stuff if you need to. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949372#3949372 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949372 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
Sorry for the badly quoted message :-) S. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949358#3949358 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949358 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
"[EMAIL PROTECTED]" wrote : "dbudworth" wrote : This is the expected behavior and what is required by the specification. If you make a this pointer method call, it is a regular Java invocation. You can get an "EJB this pointer" through SessionContext method getBusinessObject (or whatever the name is, i forget). | | | | This sounds rather silly/complicated. Maybe it is time for another JBoss-specific extension to the spec to make this (a whole lot) easier? | | S. | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949357#3949357 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949357 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
"dbudworth" wrote : we found that the TransactionAttribute annotation gets ignored when calling other methods in from a session bean. | | ie: | | | public void doSomething() { // this is the method called from the client | | doSomethingInNewTx(); | | } | | | | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) | | public void doSomethingInNewTx(){ | | ... | | } | | | | | | But calling doSomethingInNewTx() from the client would actually create the tx. (guess you have to be going through the proxy to get the annotation to do it's thing) | | We ended up turning on full blown LoadTimeWeaving AOP and using @Tx for this situation. | This is the expected behavior and what is required by the specification. If you make a this pointer method call, it is a regular Java invocation. You can get an "EJB this pointer" through SessionContext method getBusinessObject (or whatever the name is, i forget). Bill View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949355#3949355 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949355 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
"dbudworth" wrote : We ended up turning on full blown LoadTimeWeaving AOP and using @Tx for this situation. | David, did you simply let your @Tx annotation do an 'em.joinTransaction()' as if the persistence context was application managed? S. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949349#3949349 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949349 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
"dbudworth" wrote : We ended up turning on full blown LoadTimeWeaving AOP and using @Tx for this situation. | Uhhh. Does that mean that transaction management in EJB3 is completely broken? S. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949286#3949286 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949286 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
we found that the TransactionAttribute annotation gets ignored when calling other methods in from a session bean. ie: | public void doSomething() { // this is the method called from the client | doSomethingInNewTx(); | } | | @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) | public void doSomethingInNewTx(){ | ... | } | | But calling doSomethingInNewTx() from the client would actually create the tx. (guess you have to be going through the proxy to get the annotation to do it's thing) We ended up turning on full blown LoadTimeWeaving AOP and using @Tx for this situation. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949248#3949248 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949248 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: Help w/ TransactionAttributeType.REQUIRES_NEW
I ran my test in the debugger. When the TxTestBean is deployed I see the TxInterceptorFactory create a new instance of a TxInterceptor.RequiresNew for the part3() method. However when the test is executed, a breakpoint set on TxInterceptor.RequiresNew.invoke() never gets hit. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949230#3949230 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949230 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user