Sounds like the foreign key didn't make it into the database. Look at
your database meta data (or have the entity engine do it) to make sure.
The entity engine does not check foreign keys, it lets the database
do that.
-David
On Mar 13, 2007, at 3:01 PM, Christopher Snow wrote:
> If I 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)] ...
>
> Any ideas???
>
> Thanks in advance ...
>