I think this problem has been discused within the last two month on the mailing list.
There had been two solutions:
- use binding file to omit Prices class ( ArrayList of Price in Product)
- map Prices to a view on Product table
You may have the idea to use Product as a wrapper for Prices and omit a sql mapping
for Prices, but this will not work. The backgroud of this is that marshalling to xml
expects other getter/setter methods than storing to database does.
xml:
Prices getPrices()
void setPrices(Prices prices)
sql:
ArrayList getPrices()
void setPrices(ArrayList prices)
As names for getter/setter methods are defined with field element you can not
define different methods for xml and sql.
Hope this helps
Ralf
----- Original Message -----
From: "Hiran Chaudhuri" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 1:43 PM
Subject: [castor-dev] Help for mapping.xml
> Hi there.
>
> I'm trying to map some objects for persistency, but Castor does not behave
> as I expect it to. Perhaps someone can tell me what goes wrong?
>
> >From a schema I generate some classes. Basically the xml document looks like
> this:
>
> <product>
> ...
> <prices>
> <price>...</price>
> <price>...</price>
> ...
> </prices>
> </product>
>
> I get the classes Product, Prices and Price, where Prices just represents an
> object with an ArrayList.
> Now if I try to map this to tables with Castor, I expect to use two tables,
> namely product and price.
> Whatever I specify inside mapping.xml, Castor does not care for the prices
> object at all, thus not storing any price information.
>
> How should a mapping for this structure look like?
>
> Hiran
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev