]
Carlo de Wolf reassigned EJBTHREE-1187:
---------------------------------------
Assignee: Emmanuel Bernard
Problem on updating M:N relations
---------------------------------
Key: EJBTHREE-1187
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-1187
Project: EJB 3.0
Issue Type: Bug
Components: EJB3 Extensions
Affects Versions: AS 4.2.2.GA
Environment: JBoss 4.2.2.GA
Windows system 32-Bit
Reporter: Roland Burgermann
Assigned To: Emmanuel Bernard
Attachments: JAVAFiles.zip, JBossLog_Part.txt, M_to_N_Relation.jpg
I got a problem with updating the relation table between two entities.
This problem only occurs when i'm using a "Listener" class to set a field
from a MappedSuperclass.
I have a GeneralEntity as MappedSuperclass with one attribute and two entities which
inherit this field from the GeneralEntity. Additional the Parent and Child have one idFeld
which is tagged as Identifier and one dataField from type String. Between Parent and child
we have a M:N relation.
When i send an update to the database with a parent object including a child object, the
persist method is called and data is saved correctly in the database.
When i send an update again (with or without changes) and using the same identifiers,
then is no update on parent table, no update on child table, which is correct when nothing
is changed, BUT we have an delete on the relation table!!
I check the server log and found the following part, where the delete statement is
triggered:
2007-12-13 16:47:23,546 DEBUG [org.hibernate.SQL] delete from PARENTS2CHILD where
PARENTS_ID_FELD1_FK=? and CHILD_ID_FELD2_FK=?
For a second test i add the annotation @persistence.column.update to the systemId
attribute in the MappedSuperclass. So the system should ignore this field when updating.
When i call the update method the first time. All data is inserted correctly to the
database.
When i call the update method the second time to change the dataFields i got an unique
constraint error from the database, because the system is trying to make a insert on the
relation table!! This is not possible because the necessary entry is existing yet.
The server log looks similar to the server log above, but instead of the delete statement
we have an insert statement.
It's a bit of a strange problem, because this only happens when using a listener and
setting a field from a MappedSuperclass in there and having a M:N relation or a relation
which produces a relation table in the database.
Do i something wrong or is this maybe a bug?
Can someone give me a hint?
Thanks
Roland (Darquerus)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: