db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OJB-36) auto-insert attribute of reference/collection descriptor
Date Sat, 30 Apr 2005 08:41:05 GMT
     [ http://issues.apache.org/jira/browse/OJB-36?page=comments#action_64145 ]
Thomas Dudziak commented on OJB-36:

IMO it would make it more sense to add a new value for the auto-update field, for instance
'create'. This is similar to 'object': it directs OJB to create a database entry if the child
object does not have a primary key yet, but otherwise behaves like 'link'.

> auto-insert attribute of reference/collection descriptor
> --------------------------------------------------------
>          Key: OJB-36
>          URL: http://issues.apache.org/jira/browse/OJB-36
>      Project: OJB
>         Type: Improvement
>   Components: PB-API
>     Versions: 1.0.3
>  Environment: Windows XP Pro, Java 1.4.2
>     Reporter: Bobby Lawrence

> Currently , there are "auto-retrieve", "auto-update" and "auto-delete" attributes for
reference/collection descriptors.  Auto-retrieve tells OJB to retrieve a reference or collection
when its parent is instantiated.  Auto-delete tells OJB to delete a reference or collection
when its parent is deleted (much like cascade-delete).  Auto-update tells OJB to insert OR
update a reference or collection when its parent is inserted or deleted.
> I would like to see an "auto-insert" attribute.  Basically break out the logic from "auto-update"
into an "auto-insert" and an "auto-update".  The "auto-insert" would tell OJB to insert the
reference when its parent is updated or inserted.  The "auto-update" would tell OJB to update
the reference when its parent is updated or inserted.
> The current way causes some headache it seems.  
> I have a WAR that uses OJB for its backend.  
> Say I have a Person object that contains a reference to an Organization object.  In the
repository.xml, auto-update is set to "object".  Basically, if the Organization doesn't exist,
I want OJB to add it.  If it exists alreay, I don't want OJB to do anything.
> Say I have a JSP where a user can update the Organization of the Person.  I want to display
all the organizations in a select box with the OrganizationId as the value to pass to the
next step.  Now, in the next step, if I don't lookup the Organization for that id, but just
call PBroker.store(Person w/ Organization that only has id), OJB will update the organization
table for that organization id and set all the other fields to null.
> It would be nice if I could tell OJB to insert when it needs to and update when it needs
to.  Basically break the logic out.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message