this behaviour could lead to integrity violations if the intermediary table has contraints to the m-side.
jakob
Thomas Mahler wrote:
Hi Oliver,
AFter looking at your testcase I can confirm that this is a bug.
It should not be necessary to turn on auto-update="true" to populate the indirection table.
the auto-update="true" feature should only be required if you want to update the referenced object(s) too.
If you provide a fix I'll check it in ASAP!
cheers, Thomas
[EMAIL PROTECTED] wrote:
Hello,
I have noticed that running the appended test case requires a small change in BaseContentImpl, the super class of Paper:
add the following accessors:
public List getQualifiers() { return qualifiers; }
public void setQualifiers(List qualifiers) { this.qualifiers = qualifiers; }
BTW: the field BaseContentImpl.qualifiers in currently unused. Intended?
If someone could please verify that this is a bug, then I will
try to fix it. It currently prevents us from
updating to current CVS head, and I do not want to change our application unless I have to.
Olli
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 8:38 AM To: [EMAIL PROTECTED] Subject: updating n-m relation with rc4
Hello,
I have noiticed a change of behaviour from rc3 to rc4 which I consider a bug.
I have wrote a junit test case that reveals the behaviour. Recall that Paper has a collection of Qualifiers,
which is mapped to an indirection table.
The collection-descriptor (in repository_junit.xml)
has auto-update="false".
public void testStorePaper() { String now = new Date().toString(); Paper paper = new Paper(); paper.setAuthor("Jonny Myers"); paper.setDate(now); Qualifier qual = new Topic(); qual.setName("qual " + now); paper.setQualifiers(Arrays.asList(new Qualifier[] {qual})); broker.beginTransaction(); broker.store(paper); // will appear in the database broker.store(qual); // will appear in the database Identity paperId = new Identity(paper, broker); broker.commitTransaction(); // now the indirection table CONTENT_QUALIFIER is still empty.
broker.clearCache();
broker.beginTransaction();
Paper retPaper = (Paper)broker.getObjectByIdentity(paperId);
System.out.println("retrieved: " + retPaper);
List qualifiers = retPaper.getQualifiers(); // should contain the above
qual.
System.out.println("ret qualifiers: " + qualifiers);
assertEquals(1, qualifiers.size()); // fails, qualifiers is empty !
broker.commitTransaction();
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
