Thanks a lot, I understand that I need a transaction now, while before 
it could work without this... I have no idea of how to do that.

I noticed that in the doc of amber 
( there was a 
@TransactionAnnotation but this makes a syntax error !
Thanks to eclipse I found a @TransactionAnn, I added it at the beginning 
of my function definition, but this does not change (no update generated)

Is there any doc about this ?

Daniel López wrote:
> Hi again,
> Some quick tests show that no persist() or merge() should be necessary 
> to update an entity inside a persistent context. I tested with Hibernate 
> and Amber as persistence providers and in both cases, nothing was 
> necessary. That was using Resin 3.1.5 and RESOURCE_LOCAL as transaction 
> type, which means that the problem might be with the container managed 
> transactions.
> S!
> D.
> Daniel López escribió:
>> AFAIK, using merge should not be necessary unless the entity has been 
>> updated outside a "persistent context" and then needs to be synchronised 
>> back with the DB contents. persist() is just for new entities so reading 
>> the docs, updating an entity inside a persistent context should require 
>> no action. Unless an exception is thrown, of course ;).
>> I'm going to do some tests...
>> S!
>> D.
>> Matt Johnston escribió:
>>> I think you will need to use either the persist() or merge() methods of 
>>> the EntityManager in order to save your data to the database. In your 
>>> case since you are updating an existing record, you will need to use:
>>> m_manager.merge(homeobj)
>>> Matt
>>> Riccardo Cohen wrote:
>>>> Hi
>>>> I used to play with entity ejb with resin 3.0 with no problem. Now in 
>>>> 3.1.5 I have this code :
>>>>    @PersistenceContext(name="public") private EntityManager m_manager;
>>>>    public boolean set_homeinfo(int id_user,String title)
>>>>    {
>>>>      boolean success=false;
>>>>      Query hqr=m_manager.createQuery("select h from homeinfo h where 
>>>> h.id_user="+id_user);
>>>>      List<homeinfo> hitems = (List<homeinfo>)hqr.getResultList();
>>>>      if (hitems.size()==1)
>>>>      {
>>>>        homeinfo homeobj=hitems.get(0);
>>>>        System.out.println("title was "+homeobj.getTitle());
>>>>        homeobj.setTitle(title);
>>>>        success=true;
>>>>      }
>>>>      return(success);
>>>>    }
>>>> The select works all right, but the "title" field is never modified. I 
>>>> added finer info on sql to see database requests in log, and there is no 
>>>> "update". Did I miss something ?
>>>> I looked at the resin amber tutorials, but there are only "select" 
>>>> samples, I did not see "insert" and "update" samples... I remember 
>>>> problems like this with 3.0 when the entity bean was reused, it was not 
>>>> saved, but here it is not the case.
>>>> Thanks for any help.
> _______________________________________________
> resin-interest mailing list

Très cordialement,

Riccardo Cohen
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49

resin-interest mailing list

Reply via email to