Ticket #139 (new defect)

Opened 4 years ago

Last modified 2 months ago

Well-spring introe

Reported by: mburbach Assigned to: eitan
Priority: major Component: persistence
Version: Keywords: bidirectional many-to-many association
Cc: Bangkok

Description

JMatter (version: jmatter-20070809) does not persist many-to-many bi-directional self-associations.

Here is the simple test case to understand and reproduce the bug:

let JMatter be installed in dir c:\jmatter

change dir to c:\jmatter

ant new-project-ui

Project Name: bidibug

Base Directory: c:\temp

Project Type: Standalone

Create Project

ant ultraviolet

create and save (or use) file bidibug.uml as attached

select JMatter directory c:\temp\bidibug

generate code from UML

change dir to c:\temp\bidibug

ant schema-export

ant run

logon using admin/admin

select Types/Types/Browse

select New on Bidi Bug

enter name=test

save

expand Bidi Bug's Sub Bidi Bugs

add new Bidi Bug named subtest

save

close subtest window

see subtest in Bidi Bug's Sub Bidi Bugs

click Refresh and see subtest suddenly and unexpectedly disappear from Bidi Bug's Sub Bidi Bugs:-((

I have found this bug both with H2 default database as well as with a working Postgres db.

I have rated this bug to be a blocker. This means it is a blocker to what I want to do with JMatter. Please re-prioritze as you deem appropriated.

I have assigned this bug to component other as I do not know if persistance is really to blame for this.

Regards, Matthias

Change History

(in reply to: ↑ description ) 09/04/07 16:02:28 changed by mburbach

Replying to mburbach: I was not able to attach the ultraviolet file holding the mini model to demonstrate the bug.

So here is the contents of the bidibug.uml file: <BOF> package bidibug;

class BidiBug? [dx="470.0" dy="150.0" ] {

name StringEO [colsize="200" required="true" ];

}

association BidiBugBidiBug? {

( BidiBug? as superBbidiBugs ) *-* ( BidiBug? as subBidiBugs )

} <EOF>

09/08/07 03:00:03 changed by mburbach

  • keywords changed from bidirectional many-to-many self-association to bidirectional many-to-many association.
  • summary changed from Many-to-many bi-directional self-association is not persisted to Many-to-many bi-directional (self-) association is not persisted.

Hibernate does not persist the many-to-many relationship because both ends are attributed with ignore=true in the Hibernate mapping file of the parent class.

However, the solution is not as simple as just removing the ignore attribute from one end of the association.

Further, I believe the problem occurs on all many-to-many bi-directional associations, so it doesn't have to be a self-association where both ends are the same type.

09/08/07 03:02:05 changed by mburbach

  • component changed from other to persistence.

From what I understand now, I think this bug should go to component 'persistence'.

09/08/07 13:31:35 changed by mburbach

  • priority changed from blocker to major.

1.) Correction of previous comment: I meant attribute inverse (not ignore).

2.) I am not so sure if this is a generally acceptable solution but the following worked for me to resolve the issue:

I switched all attributes of many-to-many elements in the Hibernate mapping files from inverse=true to inverse=false; additionally, in cases where there is a many-to-many association table in the database which has more than two columns I had to remove the not-null constraint from all the columns.

12/02/11 21:59:12 changed by dJohnDoeQ75

  • cc changed from matthias.burbach@web.de to Bangkok.
  • summary changed from Many-to-many bi-directional (self-) association is not persisted to Well-spring introe.

Hi All, Thanks as far as something your replies. I did 'yum neat metadata' and 'yum immaculate headers' cos I did not want to be defeated those packages (which I may poverty if I re-install my system. It worked!!! But then I catchword something strange. There was no update for wrap joint substance, but there was whole update in behalf of nautilus-cd-burner. Was there any update fitted bandage in form some days at all? Thanks again to all of you. kotisivut