I found what was wrong, the begin() was not at the right place :
query = ...
homeobj = (Home) query.getSingleResult();
_ut.begin();
homeobj.setTitle("new-title");
_ut.commit();
Sorry for the trouble. I'll write a little sample to clarify all that
(for me at least)
The @
On Mar 11, 2008, at 6:28 AM, Riccardo Cohen wrote:
> After some new tests, I found something that works :
>
> if I do :
>
> homeobj=m_manager.find(homeinfo.class,theid);
> homeobj.setTitle(title);
>
> the object is saved
> but if I use the homeobj that comes from
>
> Query hqr=m_m
On Mar 11, 2008, at 6:28 AM, Riccardo Cohen wrote:
> After some new tests, I found something that works :
>
> if I do :
>
> homeobj=m_manager.find(homeinfo.class,theid);
> homeobj.setTitle(title);
>
> the object is saved
> but if I use the homeobj that comes from
>
> Query hqr=m_m
After some new tests, I found something that works :
if I do :
homeobj=m_manager.find(homeinfo.class,theid);
homeobj.setTitle(title);
the object is saved
but if I use the homeobj that comes from
Query hqr=m_manager.createQuery("select h from homeinfo h where
h.id_user="+id_us
Hi again,
I tried @TransactionAnnotation but it generated frequent errors like this :
[10:44:42.851] {http--8000-2} error: cannot read: mp/adminservlet.java
[10:44:42.851] {http--8000-2} 1 error
the select still work but no update
I tried then with the UserTransaction method, but there was no
On Mar 10, 2008, at 1:29 AM, Riccardo Cohen wrote:
> 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
> (http://caucho.com/resin/doc/amber.xtp) there was a
> @Transaction
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
(http://caucho.com/resin/doc/amber.xtp) there was a
@TransactionAnnotation but this makes a syntax error !
Thanks to eclipse
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
ty
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 acti
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 en
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(
11 matches
Mail list logo