Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-36

auto-insert attribute of reference/collection descriptor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.3
    • 1.0.5
    • PB-API
    • None
    • Windows XP Pro, Java 1.4.2

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            svnfightsvn Bobby Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: