What is the difference between inject and ejb




















Hey, I've got an idea! After all, EJB already exists and has a shorter name. Jesus, in my very first reply in this thread , I wrote:. It seems more or less related to WELD , but I'm not sure that my patch will help you if you don't have a local interface. Home Content Places Search Cancel. Error: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page.

Please enter a title. You can not post a blank message. Please type your message and try again. Do you lose any EJB facilities when using Inject? Thanks in advance, J. QuoteService controllers. NotSerializableException: services.

The situation is similar as 1a. When T2 commits, it attempts to acquire an exclusive lock and blocks. The system is blocked again. Conclusion: it's fine with optimistic locking if no premature flushes happen, which you can not stricly control.

What is the difference between Inject and EJB. Asked 4 Months ago Answers: 5 Viewed 46 times. Hm, let's list all cases. The read by T1 does not acquire a lock. The read by T1 acquire a shared lock. The situation is similar as 1a 2b If T1 did not flush prematurly, T1 holds a shared lock. Only authorized users can answer the question. Please sign in first, or register a free account.

Not the answer you're looking for? Also via: meetup. Is it possible to pass additional custom configuration to an EJB, ie. If not, is it possible to create an EJB via a Producer method that performs some configuration upon creation? In our case it works only with Inject but not with EJB. Posted by Thanks for this clear explanation! This was exactly what I was wondering However if you're building portlets for liferay you cannot use the CDI adding the beans.

Just create 2 Java classes and Inject them into each other's public fields. If that works then my answer is wrong. If that does not work, then my answer is correct so far.

Next change the Inject to EJB and possibly annotate the classes themselves? I forget. Then the cyclic mutual injection should work fine. Hope this makes sense. I created two pojo's and injected the pojo's into each other.

Works without problems in my config WildFly 8. Thanks MartijnBurger, I'll confirm that, and in the meanwhile add a note of caution to my answer. No exactly sure what you wanted to achieve, but this probably does exactly what you wanted and without a circular dependency. Also asynchronous CDI events could be a cleaner way to go depending on the requirements. Basically, Inject is always better, since: it is more typesafe, it supports Alternatives, and it is aware of the scope of the injected object.

John Manko John Manko 1, 20 20 silver badges 45 45 bronze badges. While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. That way this answer would be valuable even now when the link is dead. Chris Chris 6 6 bronze badges. Sign up or log in Sign up using Google.

Sign up using Facebook.



0コメント