From: Son To <son...@ya...> - 2002-02-28 04:09:14
|
Gavin, Thanks! this was what I was looking for. The documentation needs more examples. I will work on the documentation as I learn more about hibernate. In the xml map file, how to specify a non null property? thanks, Son --- Gavin_King/Cirrus%CI...@ci... wrote: > > 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> > > > _______________________________________________ > Hibernate-devel mailing list > Hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com |