Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Embeddables, association-override and cascade-merge

Hello,

following problem:

i have defined an embeddable with mapping:
  <orm:embeddable class="Money">
    <orm:attributes>
      <orm:basic name="amount"/>
      <orm:many-to-one name="currency"  fetch="LAZY">
      	<orm:join-column column-definition="decimal" name="ID_CURRENCY"
referenced-column-name="ID"/>
      	<orm:cascade>
          <orm:cascade-merge />
        </orm:cascade>
      </orm:many-to-one>
    </orm:attributes>
  </orm:embeddable>
</orm:entity-mappings>

Currency is specified as follows:
  <orm:entity class="Currency">
    <orm:table name="SYSP.CURRENCY"/>
    <orm:attributes> 
      <orm:id name="id">
        <orm:column name="ID"/>
      </orm:id>
      <orm:basic name="name">
        <orm:column name="NAME" nullable="false"/>
      </orm:basic>
...
    </orm:attributes>
  </orm:entity>

in another mapping i use the embeddable:
<orm:embedded name="airfreightRisk">
        <orm:attribute-override name="amount">
          <orm:column name="AIRFREIGHTRISK" nullable="true" />
        </orm:attribute-override>
        <orm:association-override name="currency">
          <orm:join-column name="ID_CURRENCY_AIRFREIGHTRISK" nullable="true"
referenced-column-name="ID" />
          <orm:cascade>
          <orm:cascade-merge />
        </orm:cascade>
        </orm:association-override>
      </orm:embedded>

In my CLF Test i create a new Entity and set the Attribute airfreightRisk
with a Money-Object which carries a loaded and already persisted
Currency-Object.

Trying to persist the new Entity brings me to the following problem:
* everything works fine staying attached.
* building the Object-Tree with detached Objects and merge the whole tree
results in an insert for currency
--> the cascade-merge in embeddables seems not to work?!

Any ideas?

Stefan


-- 
View this message in context: http://old.nabble.com/Embeddables%2C-association-override-and-cascade-merge-tp33407178p33407178.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top