You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by jo...@on-ergy.de on 2005/07/07 11:25:50 UTC
Customizing 1:1 querys like customized collection queries
Hello OJB-Users,
I have even started using OJB and so far all works fine :o) (1:1, 1:n...)
I would be pleased when you can help me with my first Problem.
I'm looking for an solution like 'Customizing collection queries'
descriped in the Guide 'advanced O/R technique' for 1:1 references.
A short example:
I have multible tables (named parts, driver...) and for each entry of a
table i can reference to ONE entry of a table named memo across the
primary-key as foreign key in the memo-table.
To have a unique key, I musst save a second value in the memo-table to
know from which table the foreign-key comes. This value is a String and is
hardcoded in the software.
For table parts i save = "part" in the table Memo field parentTable
For table driver i save = "driv" in the table Memo field parentTable
Now, when I'm loading the memo to an item of the parts-table, I want' only
load the memo where in table Memo parentTable="part"
With a 1:n, thats no Problem, because I can work with the query-customizer
like this
################################
<inverse-foreignkey field-ref="parentObjId"/>
<query-customizer
class="de.on_ergy.lakon.data.QueryCustomizerLakonImpl">
<attribute
attribute-name="parentTable"
attribute-value="TEILSTAM"
/>
</query-customizer>
################################
There I can add the value "TEILSTAM" to the Query with the written
QueryCustomizerLakonImpl
But how can I realize this with 1:1 ??
Thank you very very much for your help.
Best Wishes
Josef Wagner
/Germany