Em Mon, 14 Dec 2009 07:55:21 -0200, Alessandro Bottoni <alexbott...@gmail.com> escreveu:

Hi All,

Hi!

3) In his Jumpstart's FAQ, Geoff Callender says:

"Why did the Data Access Object pattern ever exist? As I recall it had
two purposes: to abstract away the data sources, and to hide the
implementation of accessing the data.

I agree!

That is exactly what JPA (Java
Persistence Architecture, also known as EJB3 Persistence) does too. So I
argue that JPA has taken the place of the DAO and there's no need for us
to write our own. JumpStart uses JPA as its DAO."

I disagree. If a DAO exists the abstract away the data source and the *implementation of accessing the data*, JPA is one implementation, Hibernate is another, purde JDBC is another, etc. What if you want to change your persistence to Google's BigTable (low-level API) or HBase or MongoDB or DB4O? You have to change business rule code (they use JPA directly), and the DAO pattern was created exactly to avoid this kind of sistuation.

What do you think about this? Would you use the JPA entity also for
hosting some business logic?

I put in an entity all the logic that can be implemented just by using its fields values. Example: if I have an Order entity that has Items, the getTotalValue() method is placed in Order. Anything else goes to the business logic classes.

Would not this approach represent a net
lost of flexibilty (because of a lack of "loose coupling")?

IMHO, yes.

4) Is there any good tutorial or any good working demo regarding the use
of Hibernate and/or Jpa with Tapestry5? At the moment I'm studying/using
the following tutorials and demos/apps.

http://tapestry.apache.org/tapestry5.1/tapestry-hibernate/userguide.html
http://tapestry.apache.org/tapestry5.1/tapestry-hibernate-core/conf.html

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to