Dev - entity-one on view of 2 tables, problem?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Dev - entity-one on view of 2 tables, problem?

Hans Bakker
Hi Everybody.

If i do an 'entity-one' on a view which consist out of two tables like:

<entity-one entity-name="ContentDataResourceView" value-name="outputView">
     <field-map field-name="contentId" env-name="parameters.forumMessageId"/>
</entity-one>

I get nothing and the log tells me:

PrimaryKeyFinder.java:132:INFO ] Returning null because found incomplete
primary key in find: [GenericEntity:ContentDataResourceView]
[contentId,msg10002(java.lang.String)]


This view is a one-one relationship between two tables so the contentId should
be enough for the primary key, however the system thinks it needs the
resourceId which is the connection between the two tables too...

Am i overlooking something?

--
met vriendelijke groet,
Hans Bakker
A-NeT Internet Services (www.a-net.nl)

E-Mail public key can be downloaded from:
www.a-net.nl/hbakkerA-net.asc

--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - entity-one on view of 2 tables, problem?

David E. Jones
Right now the entity engine uses a _very_ simple algorithm for determining the primary key fields of a view entity:

1. if the field is in the pk in the entity it comes from, then it is part of the pk

This could certainly be made more intelligent to handle the situation you are talking about where one of the pk fields can be derived from another, thus simplifying the primary key.

You might be able to trick it be have the dataResourceId field (which I guess is the one you don't want in the pk...) coming from the Content entity and not from the DataResource entity (explicitly exclude it form the DataResource entity if needed). I'm not sure about this, but it occurred to me that this might take care of it.

-David


Hans Bakker wrote:

> Hi Everybody.
>
> If i do an 'entity-one' on a view which consist out of two tables like:
>
> <entity-one entity-name="ContentDataResourceView" value-name="outputView">
>      <field-map field-name="contentId" env-name="parameters.forumMessageId"/>
> </entity-one>
>
> I get nothing and the log tells me:
>
> PrimaryKeyFinder.java:132:INFO ] Returning null because found incomplete
> primary key in find: [GenericEntity:ContentDataResourceView]
> [contentId,msg10002(java.lang.String)]
>
>
> This view is a one-one relationship between two tables so the contentId should
> be enough for the primary key, however the system thinks it needs the
> resourceId which is the connection between the two tables too...
>
> Am i overlooking something?
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev