-
1. Re: JBoss bug ou EJB bug???
martinganserer Nov 17, 2005 6:50 AM (in response to lsalves)Hi,
I know it helps you not really further but in my app I do it in the the same way you do it in your example. But it works in my app. And I must say that I use many lazy associations.
For getting the stub of my facades I am using the inital context.
Example:Facade facade = (Facade) ctx.lookup(Facade.class.getName());
Maybe you try this?
I had the same problem with JBoss 4.0.3SP1. Are you really sure that you are using SP1? -
2. Re: JBoss bug ou EJB bug???
lsalves Nov 17, 2005 8:19 AM (in response to lsalves)The ServiceLocator.lookupEJB( Class ) uses InitialContext like your example.
I'm sure about JBoss 4.0.3SP1. What version do you use? Did you use the installer package or do some modification/upgrade? -
3. Re: JBoss bug ou EJB bug???
martinganserer Nov 17, 2005 8:30 AM (in response to lsalves)Hi,
I use JBoss 4.0.3SP1. I used the installer package and didn't make any mods or something like that.
Maybe you can try another approach:
Lookup for the facade outside of the transaction. I am not sure but maybe it helps! -
4. Re: JBoss bug ou EJB bug???
lsalves Nov 17, 2005 9:15 AM (in response to lsalves)Thaks for your help, but still doesn't work.
Are you sure you are using lazy collections outside EJB? In a Action Struts or JSF Managed Bean?
Are EJB's stateless or stateful? Are you using depency injection to get Entity Manager? Is entity manager extended? -
5. Re: JBoss bug ou EJB bug???
martinganserer Nov 17, 2005 10:30 AM (in response to lsalves)Hello,
I don't use Action Struts and I don't work with JSF Managed Beans either.
I simply work with servlets and JSPs. But I don't think that this really matters. In my application I only use stateless session beans as Data Access Objects and I use dependency injection all the time for my entity manager. Therefore my entity manager doesn't use the extended persistent context.
If it doesn't work with JSF or any other framework i would test my app within a simple servlet. -
6. Re: JBoss bug ou EJB bug???
lsalves Nov 17, 2005 12:45 PM (in response to lsalves)I change my code to a Servlet and still not working. Was just a test... really make no sense work in a Servlet and doesn't work in a JSF Managed Bean.
Are there any special configuration in your persistence.xml?
Could you show me the content of your persistence.xml properties tag? Specialy hibernate.transaction.factory_class and hibernate.transaction.manager_lookup_class. -
7. Re: JBoss bug ou EJB bug???
patrick_ibg Nov 17, 2005 4:36 PM (in response to lsalves)I did notice that you looked up UserTransaction from the service locator... I'm not sure that will work.
I think maybe the problem is that the transaction you are getting is not the same as the transaction that is used by AplicacaoFacade.
If you want to use JSF with container managed transactions, try coding your managed bean as an EJB (look into JBoss SEAM). Or implement AplicacaoFacade as a POJO... -
8. Re: JBoss bug ou EJB bug???
martinganserer Nov 18, 2005 5:53 AM (in response to lsalves)Hello,
I made some test to figure out if lazy loading really works with UserTransactions!
And now I can definitly say that it works in my app. The facade I use is a stateless session bean that uses an injected entity manager. In my servlet I use the local interface. So from my point of view it is not a Jboss bug!
It might be really the problem that the the transaction you are creating is not the same the entity manager uses. But I am really not sure about this. Taking a look at your code tells me that everything should be OK!
There is one thing that we don't have covered yet! The entity beans!!
Please create a stateless session bean to test if the lazy loading works there. If not the problem is the entity bean mapping and has nothing to do with the UserTransaction!
What do you think about that? -
9. Re: JBoss bug ou EJB bug???
lsalves Nov 18, 2005 6:49 AM (in response to lsalves)Thanks Martin and Patrick!!!
It's working!!! The secret is that Martin is using a Local interface, while I was using a Remote interface for session façade. -
10. Re: JBoss bug ou EJB bug???
martinganserer Nov 18, 2005 6:53 AM (in response to lsalves)Hello,
that's great! I am happy that it works! -
11. Re: JBoss bug ou EJB bug???
muhviehstarr Nov 25, 2005 5:02 AM (in response to lsalves)Thank you for this useful informations!!