If you create the EntityManager in the presentation layer and pass it down to the DAO
layer, then I dont see no difference to invoking the method of EntityManager right inside
you presentation bean.
Truely layered code would mean that you business code would not even know about an Entity
Manager let alone your presentation code. Truely layered means, that the presentation bean
calls a business method and gets a result and does not care about how this result is
produced.
In my view, only the DAO class should have a dependency to the EntityManager IF you want
to truely structure your code into independent layers. Thats great for maintenance and
testing since each layer can swapped out or replaced by a different implementation without
breaking e.g. the layers above.
But this flexibility in the long term is bought by a higher complexity and more code in
the short term. Maybe you will even have to deal with
"LazyInitializationException" again depending on how you work with the
Entitymanager/Seam components.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088429#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...