I'm using
Struts 2, Spring, Hibernate+JPA, with Generic definitions for the Daos and Services (i.e. GenericDao<T, ID> and GenericService<T>). Up to this point I've been able to handle basic lists within my views. As I'm proceeding with development of the application, I now need to edit the data.
When generating the form to do this (the form is generated from a view which requires a method in the ClothingAction >> setupForInsertUpdate() ) I need to generate a list of clothing types during the setup process so that my list of options in the form can be populated as provided by the DB (accessed via ClothingTypesDao). The problem I'm having is that when I create a service within my action to handle this list creation (ClothingTypeService) and try to process the method within it called getAllClothingTypes() which uses the EntityManager defined within the GenericDao, the EntityManager is not available (most likely because it's been detached, or closed, I'm assuming).
I can post code later, but can anyone provide general insight into how I can have my ClothingTypeDao access the same EntityManager as my ClothingAction > ClothingService > ClothingDao object during that "setupForInsertUpdate()" method defined in the ClothingAction?
Thanks.