You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by je...@optonline.net on 2003/06/25 17:55:49 UTC

sub objects and a question on storing

Hey all,

I am new to object relational bridges and I am trying to accomplish a fairly complex site.   I have gotten pretty far I think looking through the demos and reading the a archives.  Bows especially to Thomas for the helping hand he has given people for quite some time.

Anyway, onto my two main questions.

Question One:  I am using PersistentNestedFieldMaxPerformanceImpl so that I can use "->" in the repository for nested objects.   Are there plans to incorporate this in with other PersistentField Attribute implementations?   Is the only difference between PersistentNestedFieldMaxPerformanceImpl and the default implementation that it accesses fields directly?



Question Two:  I have looked through the demos, but I am missing a piece of understanding about bridges.   I have a simple reference-descriptor in my repository file as shown in the code below.   I was trying to load a region based on a region id.  I could not figure out how to auto-load a new RegionVO if regionId alone changed or was about to be inserted.  This was "ok" as I knew I could manually load the new RegionVO object using a DAO.   But here is the problem I was having:  I would try to insert the LocationVO object before retrieving the RegionVO object.  Instead of just inserting the populated regionId into the database, it would insert try to insert null and would null out the regionId during store().    When I got the RegionVO first manually and populated it, regionId would be stored correctly.  Why did I have to get the RegionVO first?   The debug message I got about the field is just below:

"[org.apache.ojb.broker.core.PersistenceBrokerImpl] INFO: Cascade store for this reference (RegionVO) was set to false."


Thanks for your wisdom!!!

JohnE




<class-descriptor class="LocationVO" table="location" auto-update="true" auto-delete="true">
       <field-descriptor
              name="memberId"
              column="mid"
              jdbc-type="INTEGER"
              primarykey="true"/>
        <field-descriptor
             name="regionId"
             column="regionid"
             jdbc-type="INTEGER"/>
      <reference-descriptor
            name="region"
            class-ref="RegionVO">
        <foreignkey field-ref="regionId"/>
      </reference-descriptor>
</class-descriptor>