First of all sorry to BUMP this topic again, is just that I had been busy the last month
and I forgot to check it.
I tried to look on the wiki, but I did not find the example fernando_jmt mentioned. I
don't think that I need a DAO (after all I have read that they don't seem to be
useful on Seam although you can use them)
For example for a person maintenance page I would like to have this classes (plus the
interfaces that may be needed)
Presentation Layer: Manages all the presentation logic for this page.
Business Layer: Manages all the business logic for the class
Data Layer: Manages all the logic related to storing the object on the database.
I think that maybe I could use the manager bean as the presentation layer object and
create there the entity manager and send it as a parameter to the other layers when
invoking the methods along with the entity bean, so I would end up having something like
this:
Presentation:
public void savePerson(EntityManager em,Person person)
{
//apply presentation logic
personBusiness.savePerson(em,person)
}
Business:
public void savePerson(EntityManager em,Person person)
{
//apply business logic
personData.savePerson(em,person)
}
Data:
public void savePerson(EntityManager em,Person person)
{
//apply data access logic
savePerson(em,person)
}
I like how the code ends up separated because I think it is easier to maintain, however,
my intuition tells me that this is not the right way to do this on Seam and that this may
end up being inefficient. For example, when developing with hibernate I create the session
on the business layer, not on presentation and I think that there may also be some
features from Seam that makes this easier.
At the end of the day what I don't like about the examples I saw was that they tend to
mix this three layers in just one class, which seems a little messy to me on large
projects. If someone could provide me with a simple CRUD example for this I would be very
thankful.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088199#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...