[OFBiz] Users - Question about Entity Engine Guide
Gan Chun Yee
gcy80 at yahoo.com
Thu Sep 8 23:16:54 EDT 2005
Hi all,
I came across this statement at the Entity Engine
Guide page , which I am not very sure what does it
mean and would like to seek for advise:
"The primary key for a view entity should include all
primary key fields of each member entity of the view.
This means that all of the primary key fields must be
aliased, but fields that are used to link the entities
need only be aliased once. For example, if an
OrderHeader entity has an orderId primary key and an
OrderLine entity has an orderId primary key and an
orderLineSeqId primary key, and the orderId was the
mapped key that links the two entities, then the view
entity would have two primary keys: orderId and
orderLineSeqId. In this case orderId would only be
aliased once since by definition the orderIds from
each entity will always be the same since that is how
the entities are linked (or joined)."
Is there anybody that can help me to elaborate more?
or maybe provide me the sample configuration based on
the sample given on the statement?
Moreover, I am much appreciate if someone can really
help me to explain the sample configuration on the
Entity Engine Guide about View-Entities. It is a great
idea that we can do join queries using View-Entities
but I believe I need more guidance and explanation in
order for me to really understand it. the sample is
pasted below:
<view-entity title="Sample View Entity"
copyright="Copyright (c) 2001 John Doe
Enterprises"
author="John Doe" version="1.0"
package-name="org.ofbiz.commonapp.sample"
entity-name="SampleViewEntity">
<member-entity entity-alias="SE"
entity-name="SampleEntity" />
<member-entity entity-alias="OSE"
entity-name="OtherSampleEntity" />
<alias entity-alias="SE"
name="primaryKeyFieldOne" />
<alias entity-alias="SE"
name="primaryKeyFieldTwo" />
<alias entity-alias="SE" name="fieldOne" />
<alias entity-alias="SE" name="fieldTwo" />
<alias entity-alias="OSE" name="primaryKeyOne"
/>
<alias entity-alias="OSE" name="otherFieldOne"
field="fieldOne" />
<view-link entity-alias="SE"
rel-entity-alias="OSE">
<key-map field-name="foreignKeyOne"
rel-field-name="primaryKeyOne" />
</view-link>
<relation type="one"
rel-entity-name="OtherSampleEntity">
<key-map field-name="primaryKeyOne" />
</relation>
<relation type="many" title="AllOne"
rel-entity-name="SampleEntity">
<key-map field-name="primaryKeyFieldOne" />
</relation>
</view-entity>
Last but not least, I would like to ask is Entity
Views support nested join queries? If no, does it mean
I have to run the query using jdbc?
THank you.
Regards,
Gan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Users
mailing list