ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Snow <sno...@coralms.com>
Subject entity one
Date Tue, 13 Mar 2007 11:41:04 GMT
If have the following entities:

<entity entity-name="EntityOne" ...>
   <field name="entityOneId" type="id-ne"/>
   <field name="entityTwoId" type="id-ne"/>
   <prim-key field="entityOneId"/>
   <relation type="one" fk-name="ENT_TYP" rel-entity-name="EntityTwo">
      <key-map field-name="entityTwoId"/>
   </relation>
</entity>

<entity entity-name="EntityTwo" ..."> 
   <field name="entityTwoId" type="id-ne"/>
   <prim-key field="entityTwoId"/>
</entity>

I thought the relation type "one" would only allow me to have a value
for EntityOne.entityTwoId of either null or a value that exists in
EntityTwo.entityTwoId.  However:

bsh % e2 = delegator.findAll("EntityTwo");
bsh % print(e2);
[]
bsh % e1 = delegator.create("EntityOne", UtilMisc.toMap("entityOneId",
"1", "entityTwoId", "THIS_KEY_DOESNT_EXIST")); // this should err??

bsh % print(e1);
[GenericEntity:EntityOne][entityOneId,1(java.lang.String)] ...
[THIS_KEY_DOESNT_EXIST(java.lang.String)] ...

Where am I going wrong?

Many thanks ...

Mime
View raw message