[OFBiz] Dev - relation type one/many in entitymodel.xml

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

[OFBiz] Dev - relation type one/many in entitymodel.xml

Adam Heath-2
So, I was thinking over the weekend; why do we have to specify the type of a
relation on an entity definition?  Shouldn't it be able to be inferred by the
set of fields you are linking to?

If the set of fields on the target entity is not it's primary key set, then
it's a many relation; otherwise, it's just a one relation.

If my thinking is correct, then we could remove the need of the type attribute
alltogether.
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - relation type one/many in entitymodel.xml

David E. Jones

This has been discussed a few times. Actually the Entity Engine does  
figure out what it should be and uses the relationship type as a  
sanity check and it is done on purpose that way. If your type is  
wrong for the key-maps, it will give you a warning. It is also needed  
for the special case of the one-nofk situation, but that came along  
later and wasn't the original reason. I just read over the section  
about that in the Entity Engine guide and it doesn't state this  
explicitly, but it is implied as it does state the requirements for  
the different options.

-David


On Sep 6, 2005, at 11:24 AM, Adam Heath wrote:

> So, I was thinking over the weekend; why do we have to specify the  
> type of a
> relation on an entity definition?  Shouldn't it be able to be  
> inferred by the
> set of fields you are linking to?
>
> If the set of fields on the target entity is not it's primary key  
> set, then
> it's a many relation; otherwise, it's just a one relation.
>
> If my thinking is correct, then we could remove the need of the  
> type attribute
> alltogether.
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - relation type one/many in entitymodel.xml

Adam Heath-2
On Tue, 6 Sep 2005, David E. Jones wrote:

>
> This has been discussed a few times. Actually the Entity Engine does
> figure out what it should be and uses the relationship type as a
> sanity check and it is done on purpose that way. If your type is
> wrong for the key-maps, it will give you a warning. It is also needed
> for the special case of the one-nofk situation, but that came along
> later and wasn't the original reason. I just read over the section
> about that in the Entity Engine guide and it doesn't state this
> explicitly, but it is implied as it does state the requirements for
> the different options.

The reason I ask is I have evil plans.  The syntax I'm developing would be
better served if I didn't have to create new markup for it(it's not hard to do
so, it'd just be a higher learning curve, as people already mostly know the
syntax).

I bet you can figure out what I'm doing, based on other emails.
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev