[jboss-user] [EJB 3.0] - Re: Detached Entity passed to persist

2009-01-14 Thread jaikiran
When you return the entity back to the client from the bean, it becomes 
detached from the entitymanager. When you are passing the entity back to the 
bean, the second time, you have the option to call the 

mergedEntity = entityManager.merge(entity);

to re-attach the detached entity.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4201757#4201757

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4201757
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: detached entity passed to persist

2008-11-29 Thread PeterJ
This means that you entity is not being managed by the entity manager. Try 
merging it back in with EntityManager.merge() before persisting the changes.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4193191#4193191

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4193191
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: detached entity passed to persist

2007-06-24 Thread icordoba
I see this is an old thread but just in case someone nees a solution... try to 
enclose everyting in a UserTransaction. If you take an EJB3 entity outside the 
transaction, you cannot re-persist it or iterate over CMRs, etc. You need then 
a UserTransaction in the client side.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4057182#4057182

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4057182
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: detached entity passed to persist

2007-04-25 Thread fhh
Can  you try with id set to null? I have a feeling the the entity manager might 
think that your object has already been persisted because it already has an id.

Regards

Felix


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4040467#4040467

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4040467
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: detached entity passed to persist

2007-04-24 Thread fhh
Let me guess: An object with the id 0 does already exist since you ran your 
code at least once before.

Regards

Felix

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4040362#4040362

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4040362
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: detached entity passed to persist

2007-04-24 Thread graflaszlo
Hi Felix, 

No, the table is empty, I try to insert the first record.
I tried with id = 1, but with the same result.

Any idea?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4040429#4040429

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4040429
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: Detached entity passed to persist

2006-09-22 Thread jactor
Please help me this so I can avoid the big head ache...

After a variety of debugging, this is the case:


  | ...
  | B b = a.getB();
  | long id = saveOrUpdate(b); // Autoboxing. Originally an instance of 
Long
  | entityManager.flush();
  | b.setId(id);  // Autoboxing. Originally an instance of Long
  | ...
  |  

I discovered that the memory referance of b.getId() was put to null when I 
flushed the entity manager. Before the flushing I had done some logging, but it 
was not valid anymore.

However; after flushing, persisting/merging A, and logging that b.getId() is  
still a valid value, I still get the same exception:


  | javax.ejb.EJBException: javax.persistence.PersistenceException: 
org.hibernate.PersistentObjectException: detached entity passed to persist: 
a.package.B
  | 

Is there some sort of configuration that I did not do? I thought that the merge 
method would check that the id of the entity was valid.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3973540#3973540

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3973540
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user