Hello,

I've tried searching the archives for a solution to what should be a
common problem. Sometimes I want to persist an object graph that maps
to multiple tables in my database. OJB handles it beautifully when I
set it the reference-descriptor's auto-update attribute to "true".
However, there are times when I only want to update the main table. I
get into problems when I try to persist the object without the related
objects because I usually get a CANNOT INSERT A NULL error in the
related tables.

Therefore, my question is, can you set the auto-update conditionally?
Or am i REQUIRED to create all the related objects even if I only want
to save the main object?

I'm also wondering if I just am on the wrong track. After reading
"Professional Struts Applications" (Wrox), a particular line is hinting
that maybe I'm missing something. They say, "A Value Object is nothing
more than a view of the data and there is nothing inappropriate about
having a DAO return different types of Value Objects, all showing a
different perspective of the same piece of data." This seems to hint
that perhaps I should create a separate Value Object (with its own
metadata in repository_user.xml) for when I want to persist an object
without its related objects. This seems messy because it increases
maintenance if the object definition changes (I'll have to change it in
more than one place). Is this the standard, or best practice? What is
everyone else doing?

Thanks,

Anthony Carlos


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to