Shiva,

it is possible to map 2 different classes to the same table even if you
need to be aware of problems when changed objects are persisted or
loaded after that change. The problem is that both classes have separate
caches and they get inconsistent when objects are changed. The best idea
to omit these problems is to switch of caching for both of this classes.

The many problem you will have with your idea is that every object needs
a unique identity. If you create class A for (col1, col2, col3) for the
1 side of your 1:m relation, you will not have a unique identity as
there will be multiple records for all combinations of (col1, col2,
col3) in the database. For class B, m side of the 1:m relation, holding
values of the columns (col4, col5, col6) there may be similar problems
as I don't know if one (or a combination) of the columns can be used as
identity. If you do not have columns in (col1, col2, col3, col4, col5,
col6) that can be used as identity (primary key) it will not be possible
to use castor to access this data at all. You should also be aware that
castor do not support foreign keys that are part of primary keys.

Without more details on the constraints of the data in the table it is
impossible for me to tell you if and how you can map this data with
castor. It would also be important if you only want to load the data or
if you also want to create new or update existing ones. But even if the
constrains are ideal it will not be possible to load the data into 2
classes with a 1:m relation directly by castor.

Regards
Ralf


Shiva P. Kodityala schrieb:
> Ralf
> 
> Is it not possible because both the classes point to the same table? Or some 
> other reason?
> 
> Thanks
> 
> -----Original Message-----
> From: Ralf Joachim [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 23, 2005 8:08 AM
> To: [email protected]
> Subject: Re: [castor-user] A mapping question
> 
> 
> Hi Shiva,
> 
> I'm sorry but this is not possible with castor at the moment. You need
> to find a workaround on your java objects for this to work.
> 
> Regards
> Ralf
> 
> 
> Shiva P. Kodityala schrieb:
> 
>>I have an not-normalized table which is already existing. 
>>
>>tableX(col1, col2, col3,col4,col5,col6)
>>
>>For every (col1, col2, col3), there are number of(col4,col5,col6). Can I have 
>>a classA mapping to first part and classB mapping to second part and have a 
>>relation 1:m? - Is it possible?  If so, do I have to take any precautions? If 
>>not, what is the better approach? Of course, I am not authorized to change 
>>the design of existing table. So, Both the classes point to the same table. 
>>Ultimately, I want to get normalized data into my java objects without extra 
>>processing. 
>>
>>Thanks for help.
>>
>>
>>-------------------------------------------------
>>If you wish to unsubscribe from this list, please 
>>send an empty message to the following address:
>>
>>[EMAIL PROTECTED]
>>-------------------------------------------------
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------

-- 

Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Email: [EMAIL PROTECTED]
Web:   www.syscon-world.de

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to