Patrick,
I had a similar situation, and implemented a ManageableMap class which can
be used as the collection-class in repository.xml. It provides a get(String)
method a la java.util.Map. I'll attach it; you can adapt for your use.
-steve
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
[EMAIL PROTECTED]
(970)226-9291
>To: "OJB Users List" <[EMAIL PROTECTED]>
>From: [EMAIL PROTECTED]
>Subject: 1 to n mapping issue - can OBJ handle this complex case ?
>Date: Wed, 26 Mar 2003 09:13:18 +0100
>
>Hi to all,
>
>It looks like I am trying to do something that OJB can not handle, some
>advise would be greatly appreciated.
>
>I am trying to resolve the following problem, related to complex 1 to n
>mapping and I was wandering if OJB was able to handle this case.
>I am trying to setup a multiLanguage dictionnary where by a label can have
>multiple representations in different languages. I.E. value of Label A in
>French is not the same as value of Label A in German or value of Label A in
>English.
>
>1) First let's see the database schema
>
>Table Language (The master), is defined as:
>Create table Language (LanguageID integer primary key,LanguageName
>varchar(50))
>
>Table Label (The detail), is defined as:
>Create table Label (LabelID integer primary key, LanguageID integer primary
>key, value varchar(50))
>
>2)Ok, now it looks like it is quite easy to define a mapping allowing a 1
>to n relationship between the language table and the label table. I.E.
>retrieve all labels related to one language is quite easy with OJB.
>
>Now the real question, how can I retrieve all languages related to one
>label, since the Label table is using a multiple column primary key, I
>would like to get an object that would look like:
>
>class Label {
> int LabelID;
> Hashtable values;
>}
>
>and
>
>class Language {
> int LanguageID;
> String LanguageName;
>}
>
>Where the content of the Hashtable should store all known values from the
>Label table for a given Label. I.E. Label.values('French') = <label in
>french>
>or Label.values('german') = <label in german>. In other terms each Label
>object contains all representation of a given string in different
>languages.
>
>
>---------------------------------------------------------------------
>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]