Welcome to the real world, it sucks, but you're gonna love it !!!
Welcome to the real world, it sucks, but you're gonna love it !!!
I been really struggle and confuse about the the DAO pattern,
SCJP, SCWCD, SCBCD, SCEA 5
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Yes, the DAO should be Session Bean to able to use CMT.
The reason I ask, and this seems to be a common area of confusion, is because you already have a ready built, standardised, Domain Store courtesy of the JPA API.
go and take a look at some of the usage scenario examples for Domain Store
I often hear the argument that "Just use the JPA Domain Store, you don't need a DAO." That assumes nothing will ever replace the JPA Domain Store
If so, does it not creating too many session beans, ie. session with Bizlogic and session with DAO, will these affect the EJB container performance?
Here's a little tutorial I wrote on using DAOs with Hibernate and the JPA API
SCJP, SCWCD, SCBCD, SCEA 5
My concern is that many applications end up over-engineered,. especially when unnecessary layers do nothing but add complexity.
Jonathan Aotearoa wrote:.... if you implement your DAOs as POJOs, how do get hold of a reference to the current EntityManager. ....
Jonathan Aotearoa wrote:.... if EntityManager was only ever intended for use in POJO DAOs, then why did the EE spec writers bother providing a dependency injection mechanism for session beans?
Cameron Wallace McKenzie wrote:
Here's a little tutorial I wrote on using DAOs with Hibernate and the JPA API. You can see how well a properly designed DAO implementation, with Session EJBs or anything, can greatly benefit any application that used and implementation of JDBC access.
Welcome to the real world, it sucks, but you're gonna love it !!!
Cameron Wallace McKenzie wrote:
A DAO should never be implemented as a Session Bean. The idea of a DAO is to decouple database access from the design. Making it a Session EJB ties you to an EJB infrastructure. It means if you want to use the same DAOs in a stand-alone application, you'd have to completely re-write your application.
A DAO can be invoked by a Session bean, and the Session bean could use CMT. I'm sure that's what the original poster means. Nobody would ever recommend implementing a DAO as a Session bean.
-Cameron McKenzie
Cameron Wallace McKenzie wrote:
Yes, the DAO should be Session Bean to able to use CMT.
A DAO should never be implemented as a Session Bean. The idea of a DAO is to decouple database access from the design. Making it a Session EJB ties you to an EJB infrastructure. It means if you want to use the same DAOs in a stand-alone application, you'd have to completely re-write your application.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|