You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Sergey Manukyan (JIRA)" <ji...@apache.org> on 2005/10/25 14:13:00 UTC
[jira] Updated: (OJB-76) OJB MtoN implementor failes to work properly with composite M & N keys that have some fields common.
[ http://issues.apache.org/jira/browse/OJB-76?page=all ]
Sergey Manukyan updated OJB-76:
-------------------------------
Attachment: MtoNBroker.java
Please see fix under "FIXED" comment.
> OJB MtoN implementor failes to work properly with composite M & N keys that have some fields common.
> ----------------------------------------------------------------------------------------------------
>
> Key: OJB-76
> URL: http://issues.apache.org/jira/browse/OJB-76
> Project: OJB
> Type: Bug
> Components: PB-API
> Versions: 1.0.3
> Reporter: Sergey Manukyan
> Attachments: MtoNBroker.java
>
> From this example:
> ------------------------------------------------------------------------------------------
> <class-descriptor class="com.lear.app.sqs.beans.MyClass">
> ...
> <collection-descriptor name="allUsers" collection-class="org.apache.ojb.broker.util.collections.ManageableArray
> List" element-class-ref="com.lear.app.sqs.beans.MyUser"
> auto-update="link"
> indirection-table="CLASS">
> <fk-pointing-to-this-class column="SPUNIT" />
> <fk-pointing-to-this-class column="SPCLASS" />
> <fk-pointing-to-element-class column="SPUNIT" />
> <fk-pointing-to-element-class column="SPUSER" />
> </collection-descriptor>
> ...
> </class-descriptor>
> ---------------------------------------------------------------------------------------------------
> Calling create(myClass) on Persistent Broker, when storing link for a collection it generates INSERT SQL with duplicated field SPUNIT -> results in SQL exception:
> [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR:
> [SQL0121] Duplicate name SPUNIT not allowed.
> INSERT INTO CLASS (SPUNIT, SPCLASS, SPUNIT,SPUSER) VALUES (?,?,?,?)
> (OJB is trying to insert SPUNIT two times in one statement)
> ----------------------------------------------------------------------------------------------------------------------------
> I am using OJB 1.0.3 and only used "link", didn't try "object". I made
> a quick fix in MtoNBroker, that looks like it works for me now, please
> see the attached file. And find it under "FIXED" comment,
>
> OJB assumes that (M to N) table has only
> different fields for M key and N key when actually in my case both
> keys are composite and some fields are common.
>
> M key: k1,m1
> N key: k1,n1
>
> So (M to N) table has only 3 keys: k1,m1,n1 , not 4: k1,m1,k1,n1.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org