Login  Register

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

Posted by David E. Jones on May 07, 2006; 2:26pm
URL: http://ofbiz.116.s1.nabble.com/Dev-entity-one-on-view-of-2-tables-problem-tp167894p167895.html

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