db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vogt <Thomas.V...@TVCS.de>
Subject Re: OJB Foreign Key Problem in Persistence Broker (MySQL InnoDB)
Date Wed, 28 Jul 2004 09:01:15 GMT
Thomas Dudziak schrieb:

> Thomas Vogt wrote:
>
>> I'm using the Persistence Broker to access the data in an MySQL InnoDB
>> Database, when the Primary Key is not in the same order as the foreign
>> ky constraint is, OJB seems to erranously mix it up and tries the wrong
>> way round, this way it won't find a result.
>>
>> OJB only does so in foreign keys, when the object itself is searched
>> directly, it is found without any problem.
>>
>> I tried to solve the problem on my own, but i did not find the
>> problematic part in the source, so could someone with more detail
>> knowledge try to identify and fix the problem ?
>
>
> Why is that a problem ? You could simply change the order of primary 
> keys in the class descriptor so that your pk actually matches the fk.
> This does not affect the field order in your class nor the column 
> order in the database.
>
Thats what I did, without result, but half an hour ago I found out the 
problem is in repository_user.xml

    <reference-descriptor
        name="projektgruppen"
        class-ref="org.fhw.cabaweb.ojb.dataobjects.Projektgruppen">
            <foreignkey field-ref="gruppennummer"/>
            <foreignkey field-ref="projektnummer"/>
    </reference-descriptor>

The order of the foreign key fields here, seems to be mandatory, OJB 
just takes the order as is, and attaches the values it gets. By 
switching the order here, I solved the problem.

But there needs to be some kind of fix in thios place because it took me 
abour 1 day to get there, and only after activating all possible debug 
logs I found that the key order in the search is not the way it should 
be. OJB should check where it puts which value in a select statement 
(compare columnnames).

Thanks

Thomas

> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>


---------------------------------------------------------------------
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