db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armin Waibel (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (OJB-76) OJB MtoN implementor failes to work properly with composite M & N keys that have some fields common.
Date Sun, 13 Nov 2005 15:46:22 GMT
     [ http://issues.apache.org/jira/browse/OJB-76?page=all ]
     
Armin Waibel resolved OJB-76:
-----------------------------

    Fix Version: 1.0.4
     Resolution: Fixed

apply a modified version of the specified patch
add a test  ....broker.M2NTest#testStoreWithSharedIndirectionTableColumn() to check patch

> 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
>      Fix For: 1.0.4
>  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


Mime
View raw message