Like I said, you need to use merge() if you are not using a seam managed
persistence context.
Using @PersistenceContext does not mean that it is a seam managed one.
>From what I can gather, if you obtain your entity bean in one session bean and
>then try and update it in another session bean th
Hmm...
I'm using this in my entity manager:
|@PersistenceContext
|private EntityManager em;
|
Not sure why doing it this way the merge is required but if I don't have it I
get attached exceptions. It may be possible the entity became detached or
somehow got tangled up in a con
I've got a one-to-many relationship in one of my beans and have never had any
trouble. This is from my entity bean:
List requests = new ArrayList();
|
| @OneToMany
| public List getRequests()
| {
| return requests;
| }
| public void setRequests(List requests
Wayne,
I think I've found the answer to the mystery. The solution you pointed out
from the tutorial wasn't working for me because java.util.List.remove() wasn't
implemented for the backing List in Hibernate's PersistentBag at runtime.
I found in the Hibernate docs that collections can wind up
Either you've missed a step or two, or you are doing something unusual
somewhere in your code. You do not need to go to the lengths you are going to
just to delete something.
Do you have an @PersistenceContext annotation anywhere in your code?
Can you show us the entity bean code?
View the ori
It seems like overkill--and its a bit hard to describe w/o seeing it or the
following struggles I've had trying to accomplish this very simple operation.
In a nutshell if I do it exactly like the tutorial I get an
java.lang.UnsupportedOperationException. This is because my list comes from my
e
That seems a massive overkill.
Why aren't you using the persistence context?
Then you can just do exactly as the tutorial says:
| public void delete()
|{
| messageList.remove(message);
| em.remove(message);
| message=null;
|}
|
em.remove(message) will re
Got it! A little Easter present at the last moment. Here's the correct way to
handle the delete method for people who may have the same issue I did:
|public void delete() {
|timecardHome.getEntityManager().flush();
|timecardHome.getEntityManager().joinTransaction();