-
1. Re: Where (which layer) to put Entity query methods, “persist” methods etc. ?
thejavafreak Oct 8, 2008 11:24 PM (in response to anders.norgaard)The most common usage is to place it in your Session Bean, because the idea of Seam from the beginning is to reduce layer by joining JSF managed bean and Session Bean for Action class. But some people add another DAO layer for this, but I'd prefer using Session Bean because Session Bean is a plain POJO and you can easily unit test it. So why would I need another layer for this?
-
2. Re: Where (which layer) to put Entity query methods, “persist” methods etc. ?
anders.norgaard Oct 9, 2008 10:44 AM (in response to anders.norgaard)Ah, but I do want to reduce the number of layers. And I realize that I have some session beans/SEAM objects where I could put some private query methods. But what if another bean needs the same query? Code duplication is bad, so where to put the common code (query method)?
In a stateless session bean that both SEAM objects can access?
or
On the entity object itself? (and in that case, how do I best obtain the EntityManager/Hibernate Session?)
Best
Anders