Hi Nikolaos,
What Frank is saying is you don't have to go through Stripersist to get 
an EntityManager. The main purpose of Stripersist is to provide the 
Formatter/TypeConverter for Stripes to handle entities. It also provides 
a little security by beginning a transaction so that you must explicity 
commit for changes to occur.

I don't use Spring but I'm sure there is some way to get an 
EntityManager from Spring without going through Stripersist.

Aaron

On 05/27/2010 09:35 AM, Nikolaos Giannopoulos wrote:
> Frank,
>
> Comments in-line below...
>
>
> Frank Pavageau wrote:
>    
>> On Thu, May 27, 2010 at 5:23 PM, Nikolaos Giannopoulos
>> <nikol...@brightminds.org>  wrote:
>>
>>      
>>>     public class BaseActionBean implements ActionBean {
>>>         @SpringBean  protected ModalityDao modalityDao;
>>>         ...
>>>
>>>     @Repository("modalityDao")
>>>     public class ModalityDaoImpl extends BaseDaoImpl<Modality, Integer>
>>> implements ModalityDao {
>>>         public List<Modality>  findAll() {
>>>             return (this.load());  // [2]
>>>         }
>>>         @PostConstruct
>>>         private void init() {
>>>             this.findAll();   // [1]
>>>         }
>>>
>>>        
> <snip>
>    
>> The problem is that you have objects instanciated by the 2 frameworks
>> with independent lifecycles :
>> - Spring instanciates the DAO at context initialization (triggered by
>> the listener)
>> - Stripes instanciates the Stripersist interceptor at filter
>> initialization, and the Spring context knows nothing about it
>>
>>      
> Sure.  I get that.
>
>    
>> You don't really need to use the Stripersist interceptor in your
>> BaseDaoImpl, you just want the EntityManagerFactory injected directly
>> instead. Stripersist also gets it from the Spring context anyway
>> (AFAIR, we use our own TypeConverter with a similar mechanism).
>>
>>      
> Sorry.  Now you lost me :-)  Sounds great but what "exactly" are you
> suggesting?
>
> Much appreciated!
>
> --Nikolaos
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>    


------------------------------------------------------------------------------

_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to