On Thu, Jun 12, 2008 at 10:08 AM, <glassfish_at_javadesktop.org> wrote:
> Hi guys,
> I am new to JPA.I'm building a JSF web app(no EJB) using JPA.
> I decided to use application-managed Entity Managers. And I am not sure if
> it is a good practise write business methods like createAccount or
> deleteAccount or selectAllAccounts inside entity beans or should I leave
> them in JSF Managed Beans or even Java Beans. Thanks.
>
I'm a little weak on this particular theory, but I think the rich domain
object guys would tell you that's the way to go. Personally, I'd probably
put that sort of logic in its own class (whether it's an EJB Session Bean,
which you said you're not using, or another JSF Managed Bean). Regardless
of where I'd put it, I'd keep it in a class separate from the JSF managed
beans that are directly used for controlling the view. That gives you a
view/service layer separation, even though both parts are managed by the JSF
managed bean facility. It's more of a hand wavey separation than any real
technically enforceable one, but it has worked well for me.
--
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
Mojarra and Mojarra Scales Dev Team
https://mojarra.dev.java.net
https://scales.dev.java.net
http://blogs.steeplesoft.com