-
1. Re: Multiple instances of an entity
nproemper Nov 16, 2004 6:10 AM (in response to nproemper)Hi all,
the problem still exists and is making me mad, but I have found out some details, which I want to add for your understanding.
I try show you what happens in a kind of sequence diagram:
a) Servlet calls RelationshipoBean->setData
b) setData creates an instance of RelationshipTypeBean via findByPrimaryKey
c) setData calls RelationshipTypeBean->checkValidity
d) checkValidity searchs for other Relationship through calling findByObjTo
e) for each found entity checks are made. In case of success nothing happens, in case of an error an exception is thrown.
The problem resides in point e), because the finder returns the instance, too, which is active over all the sequence. And taking the Bean's interfaces out of the collection returned by the finder results in another instance of the SAME entity.
The documentation says, that this behaviour is impossible!? See here for a snipplet from "JBoss Admin Development Guide 3.2.6"5.4.2. Entity Bean Lifecycle
With the default configuration of JBoss there is only one active instance of a given entity bean in memory at one time.