Hi there. I am having a problem, where a child table does not have
any fields to be used as a identity by the castor mapping file's
class element. The two fields that make up the primary key for this
table both have Java Objects mapped to their fields and I am not 
sure how to write the Mapping file for this. Here is a description
of the type of table structure I have and the problem. The problem 
in my example here is in the THING_ALIASES table. 


 An Example of how a THING (id 1500) is stored:

THING (Table)
THING_ID   GROUP_ID    DESCRIPTION
------------------------------------
1500       101         'myDescription'


THING_ALIASES (Table)
THING_ID    ALIAS          SCHEME
------------------------------------

1500        'alias1'       1
1500        'alias2'       2



SCHEMES (Table)
SCHEME_ID     SCHEME_NAME
----------------------------

1             'myScheme1'
2             'myScheme2'


So for this example a Thing can have more than one Alias, but they
must
be of a different scheme.

So:

Then there would be objects Thing, Alias and Scheme.  Class Alias has
attributes of 
type Thing and Scheme. So in the mapping file, for the class element
"alias"
the optimal situation would be to be able to have an "identity"
attribute
like:
   identity="thing scheme"
but that does not seem to work. thing and scheme are classes and not 
a number or string and there is a ClassCastException thrown saying it
can not cast "thing" into a Double (or something like that). 
  Having an extra attribute in the alias class, thing_id and
 scheme_id and having the alias's identity look like:

   identity="thing_id scheme_id"

gets along a bit better but in the mapping file since the table fields
THING_ALIASES.THING_ID and THING_ALIASES.SCHEME_ID are already mapped
as:


     <field name="thing" type="Thing">
      <sql name="THING_ID" />
    </field>
  
  
     <field name="scheme" type="Scheme">
      <sql name="SCHEME_ID" />
    </field>

There is another exception thrown saying that THING_ID is used twice
and 
looking at the SQL generated , the create string is showing that it
is.


Am I just trying to use Castor as it was not meant to be used? Any help
is greatly appreciated.


Thank you 

Jayson
[EMAIL PROTECTED]

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to