From: Gavin_King/Cirrus%<CI...@ci...> - 2002-02-28 02:29:01
|
You need to decide wether Product is a component, or an associated object. If its a component, it lives in the same table as LineItem and doesn't need its own seperate <class> mapping (the mapping is done in the <component> element. If Product is an entity (which i think is what you want here), then use: <many-to-one name="product" class="openbx.domain.Product"/> in the mapping for LineItem. (ie. instead of <component ....>....</component>) Hope thats clear enough.... PS. I recommend you download the latest version it has important bugfixes. > <hibernate-mapping> > <class name="openbx.domain.Product" > table="product"> > <id name="productId" column="productId" > type="long"> > <generator class="hilo.long"/> > </id> > <property name="name" type="string"/> > <property name="price" type="double"/> > </class> > > <class name="openbx.domain.LineItem" > table="lineItems"> > <id name="lineItemId" column="lineItemId" > type="long"> > <generator class="hilo.long"/> > </id> > <component name="product" > class="openbx.domain.Product"> > <property name="productId"/> > <property name="price"/> > </component> > > <property name="quantity" type="integer"/> > </class> > </hibernate-mapping> |