0 Replies Latest reply on Jun 18, 2010 3:42 AM by Damon Chong

    Abstracting retrieval of entity objects

    Damon Chong Newbie

      Hi,


      This is more related to re-usable patterns. I have done 3 Seam application so far and realized that I have alot of java persistence retrievals that are relatively similar but coded in various different java files. My usual preference is to use a controller who will do necessary heavy lifting before returning a datamodel list to a jsf (XHTML) request. So I may end up with several controllers for various pages and each with a bit of similar code that retrieve the same entity classes (Note: one controller class is usually supporting more than one XHTML pages).


      One way I had tried to group the similar codes into a common class file. But I have to pass in the entity manager instance whenever I invoke the methods of this class to return a list of entities. Another drawback is that this class become very huge. I wonder if people had encountered this same issue and find a better solution.


      Cheers!