-
1. Re: accessing session-beans in Seam
ido_tamir Mar 5, 2006 12:14 PM (in response to andy.2003)I would not call myself even a beginner in seam, but Seam uses only annotation for configuration. So at some point you have to use @Name to make the bean available.
You could of course make another level of subclassing if this is really important:
@Name("userDAO")
UserDAOBeanSeam extends UserDAOBean
hth
ido -
2. Re: accessing session-beans in Seam
christian.bauer Mar 5, 2006 2:00 PM (in response to andy.2003)Or you could just use EJB injection, which for stateless beans is at call-time:
@EJB
UserDAO userDAO; -
3. Re: accessing session-beans in Seam
andy.2003 Mar 5, 2006 3:04 PM (in response to andy.2003)Thank you for your fast reply!
so if I choose to use the (verry cool) @EJB annotation, I have to make my Seam component also an ejb:@Name("login") @Stateless public class LoginAction imlements Login{ ... //@In(create = true) @EJB private UserDAO userDAO; ... }
I only saw the Caveatemtor example and thought it works as shown there. So I have to think about my architecture again - if I need an addidional Layer or if I want to make my DAOs depends on Seam.
Thank you guys!
Andreas -
4. Re: accessing session-beans in Seam
christian.bauer Mar 5, 2006 11:53 PM (in response to andy.2003)There is no public/official Seam CaveatEmptor example. If you got this from CVS, you got something that was under development and not working.
-
5. Re: accessing session-beans in Seam
cptnkirk Mar 6, 2006 12:50 AM (in response to andy.2003)
if I need an addidional Layer or if I want to make my DAOs depends on Seam.
I think Christian's first post was meant to point out that since your DAO is already an EJB3 SSB, that if your Seam component was also an EJB3 bean, you could use the EJB @EJB annotation and use EJB's injection. This means that you don't need to have Seam aware DAOs as long as you have EJB aware Seam components.
-Jim -
6. Re: accessing session-beans in Seam
andy.2003 Mar 6, 2006 4:05 AM (in response to andy.2003)"christian.bauer@jboss.com" wrote:
There is no public/official Seam CaveatEmptor example. If you got this from CVS, you got something that was under development and not working.
that's right, I got the current cvs version...
@CptnKirk: the reason I want to seperate the Seam from the DAO Layer is that I want to access the DAO also outside of Seam:|--------| |-----| |-----| |EJB3 / | |Seam1| |Seam2| |RMI etc.| |-----| |-----| |--------| |------------------------| | DAO | |------------------------| |------------------------| | Entity PoJo?s | |------------------------|
So I've got a "entities.par" and a "dao.ejb3" and 1 ore more Seam webapplications accessing the same DAO (web1.war, web2.war) and maybe other Applications accessing the DAO vs. RMI.
I think for this architecture the DAO Layer should not depend on seam...
Or are there better sollutions? -
7. Re: accessing session-beans in Seam
cptnkirk Mar 6, 2006 10:19 AM (in response to andy.2003)Right, I understand that you don't want to change your DAOs. I don't think you have to.
It sounds like you already have an EJB3 setup for DAO and business logic. Keep your EJB3 DAOs and simply use the @EJB in your Stateless Session Beans. At this point there is no Seam at all. Then feel free to mix Seam into your various controllers.
This will keep Seam out of your DAOs while allowing you to take advantage of both frameworks within your service layer. You should be able to have exactly the architecture you diagram. The only caveat is that Seam1/Seam2 be implemented using EJBs.
@EJB is an EJB3 annotation, not Seam.
-Jim -
8. Re: accessing session-beans in Seam
andy.2003 Mar 6, 2006 10:35 AM (in response to andy.2003)You're right, I'm trying alot to get the right structure for my project and I think DAO's meet my requirements best.
btw: I know that @EJB is no Seam annotation, but it's cool anyway ;-)
-Andreas -
9. Re: accessing session-beans in Seam
andy.2003 Mar 7, 2006 3:26 AM (in response to andy.2003)I mentioned, that I miss all the nice features Seam offers, if I dont use the @Name annotation in my Entities. So I need to wrap each Entity to access it in a JSF like:
#{user.firstname}
My question is: when I use the Seam annotations in an Entity PoJO, is there an overhead (eg. in performance), if I dont use this Entities via Seam??? -
10. Re: accessing session-beans in Seam
gavin.king Mar 7, 2006 3:29 AM (in response to andy.2003)No, no overhead at all...