Vaadin and EJB

Hello everybody,

I’m a newbie in Vaadin. I like the concept of Vaadin and I’m planning to use it in a real application. But i have some questions, it’s about EJB, i have learned with the EJB-JPA tutorial and it’s ok.

But i can have a reference to an EJB only if i declare it in the servlet, is it true?
My problem is that in the application, there is a lot of windows with EJB, but all the windows are not use in the same time so how i can do if i don’t want to declare all the EJB for each session?

Is the question clear? because i don’t speak english very well.



Container will inject EJB’s into the servlet only, but nobody permits you to lookup EJB directly via getInitialContext()…
Yep, after annotation simplicity this is a bit more work, however, but not too much.

Also, your Vaadin application is actually not a servlet. It is an object, instantiated by the generic vaadin application servlet and it is stored in the session.

thank you,

I investigated and found that I could use a BeanLocator. what I did and it works perfectly.

to the next question.


This is also what I was doing, but found an alternative that works with Java EE 6:

Note that you could do the same thing in Java EE 5 if you want to extend AbstractApplicationServlet in a separate class. But if you’re going to write a separate class, the BeanLocator function is pretty much as good.