When you model the relationships in Cayenne Modeler and then generate
the Java classes, it'll create set* methods and addTo* methods for
your relationships.

So in your case, something similar to this should work:

Category category = [code to get your Category object];
Product product = dataContext.createAndRegisterNewObject(Product.class);
product.setCategory(category);
...

/dev/mrg


On 1/20/07, Jun Bondoy <[EMAIL PROTECTED]> wrote:
Hi list,

can somebody help me please. i have a products object with to-one
relationship with my categories object. what i want to do is create a new
products and use an existing categories object. below are the steps i did...

1. lookup for my existing categories via query
2. create a new product object

how can i set the product object on the categories object before i commit?

thanks in advance..

Best Regards
-jun


Reply via email to