You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "skip@theDevers" <sk...@thedevers.org> on 2007/10/09 17:18:03 UTC

Still no response

I asked this question yesterday, but got no response.  Is there someone out
there with entity engine knowledge?

I have this bit of code:

            GenericValue payment = delegator.findByPrimaryKey("Payment",
UtilMisc.toMap("paymentId", paymentId));
...
            GenericValue paymentMethod =
payment.getRelatedOne("PaymentMethod");

The javadoc for getRelatedOne sez:

Parameters:
    relationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as specified in
the entity XML definition file.

I did not quite understand this statement as it does not seem to make sense
in this context.  Is this parameter a concatination of "Payment" and
"Method" where Payment is the relation.title and Method is the
relation.rel-entity-name?

I kinda dont think so.  I looked in the entitydef file containg Payment and
found this:

      <relation type="one" fk-name="PAYMENT_PMETH"
rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>

So, I am assuming that this particular getRelatedOne call is going to open
the PaymentMethod entity and find the related "paymentMethodId" record.

Is this correct?

Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the entity
name to look in and xxxId is the key name in xxx always?

Thanks

Skip


RE: Still no response

Posted by "skip@theDevers" <sk...@thedevers.org>.
Jacopo

THANKS!  I now grok this all fully.

Skip

-----Original Message-----
From: Jacopo Cappellato [mailto:tiz@sastau.it]
Sent: Tuesday, October 09, 2007 8:36 AM
To: user@ofbiz.apache.org
Subject: Re: Still no response


Skip,

I think that Scott already answered to your question... by the way:

in most cases the relation name is just the name of the related entity
name: in your example "PaymentMethod".
Sometimes there are more than one fields in the same entity that are
related to the same entity. In this situation, in the entity definition
you have to specify a "title" attribute together with the
rel-entity-name attribute.

Have a look, for example, to the relations from the ProductAssoc entity:

https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=Produ
ctAssoc

as you can see, both "productId" and "productIdTo" are related to the
same entity "Product", so here you have to specify a title prefix:

// ProductAssoc.productId --> Product.productId
producAssoc.getRelatedOne("MainProduct");

// ProductAssoc.productIdTo --> Product.productId
producAssoc.getRelatedOne("AssocProduct");

Jacopo


skip@theDevers wrote:
> I asked this question yesterday, but got no response.  Is there someone
out
> there with entity engine knowledge?
>
> I have this bit of code:
>
>             GenericValue payment = delegator.findByPrimaryKey("Payment",
> UtilMisc.toMap("paymentId", paymentId));
> ...
>             GenericValue paymentMethod =
> payment.getRelatedOne("PaymentMethod");
>
> The javadoc for getRelatedOne sez:
>
> Parameters:
>     relationName - String containing the relation name which is the
> combination of relation.title and relation.rel-entity-name as specified in
> the entity XML definition file.
>
> I did not quite understand this statement as it does not seem to make
sense
> in this context.  Is this parameter a concatination of "Payment" and
> "Method" where Payment is the relation.title and Method is the
> relation.rel-entity-name?
>
> I kinda dont think so.  I looked in the entitydef file containg Payment
and
> found this:
>
>       <relation type="one" fk-name="PAYMENT_PMETH"
> rel-entity-name="PaymentMethod">
>         <key-map field-name="paymentMethodId"/>
>       </relation>
>
> So, I am assuming that this particular getRelatedOne call is going to open
> the PaymentMethod entity and find the related "paymentMethodId" record.
>
> Is this correct?
>
> Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the
entity
> name to look in and xxxId is the key name in xxx always?
>
> Thanks
>
> Skip




Re: Still no response

Posted by Jacopo Cappellato <ti...@sastau.it>.
Skip,

I think that Scott already answered to your question... by the way:

in most cases the relation name is just the name of the related entity 
name: in your example "PaymentMethod".
Sometimes there are more than one fields in the same entity that are 
related to the same entity. In this situation, in the entity definition 
you have to specify a "title" attribute together with the 
rel-entity-name attribute.

Have a look, for example, to the relations from the ProductAssoc entity:

https://demo.hotwaxmedia.com/webtools/control/ViewRelations?entityName=ProductAssoc

as you can see, both "productId" and "productIdTo" are related to the 
same entity "Product", so here you have to specify a title prefix:

// ProductAssoc.productId --> Product.productId
producAssoc.getRelatedOne("MainProduct");

// ProductAssoc.productIdTo --> Product.productId
producAssoc.getRelatedOne("AssocProduct");

Jacopo


skip@theDevers wrote:
> I asked this question yesterday, but got no response.  Is there someone out
> there with entity engine knowledge?
> 
> I have this bit of code:
> 
>             GenericValue payment = delegator.findByPrimaryKey("Payment",
> UtilMisc.toMap("paymentId", paymentId));
> ...
>             GenericValue paymentMethod =
> payment.getRelatedOne("PaymentMethod");
> 
> The javadoc for getRelatedOne sez:
> 
> Parameters:
>     relationName - String containing the relation name which is the
> combination of relation.title and relation.rel-entity-name as specified in
> the entity XML definition file.
> 
> I did not quite understand this statement as it does not seem to make sense
> in this context.  Is this parameter a concatination of "Payment" and
> "Method" where Payment is the relation.title and Method is the
> relation.rel-entity-name?
> 
> I kinda dont think so.  I looked in the entitydef file containg Payment and
> found this:
> 
>       <relation type="one" fk-name="PAYMENT_PMETH"
> rel-entity-name="PaymentMethod">
>         <key-map field-name="paymentMethodId"/>
>       </relation>
> 
> So, I am assuming that this particular getRelatedOne call is going to open
> the PaymentMethod entity and find the related "paymentMethodId" record.
> 
> Is this correct?
> 
> Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the entity
> name to look in and xxxId is the key name in xxx always?
> 
> Thanks
> 
> Skip



RE: Still no response

Posted by "skip@theDevers" <sk...@thedevers.org>.
Adrain

Yes, I did not see a response from Scott for some reason (I even checked my
deleted emails looking for it).  Thanks though, Jacopo's explanation was
clear and insightful.

Skip

-----Original Message-----
From: Adrian Crum [mailto:adrianc@hlmksw.com]
Sent: Tuesday, October 09, 2007 8:44 AM
To: user@ofbiz.apache.org
Subject: Re: Still no response


Scott replied to your message. Did you miss it?

skip@theDevers wrote:

> I asked this question yesterday, but got no response.  Is there someone
out
> there with entity engine knowledge?
>
> I have this bit of code:
>
>             GenericValue payment = delegator.findByPrimaryKey("Payment",
> UtilMisc.toMap("paymentId", paymentId));
> ...
>             GenericValue paymentMethod =
> payment.getRelatedOne("PaymentMethod");
>
> The javadoc for getRelatedOne sez:
>
> Parameters:
>     relationName - String containing the relation name which is the
> combination of relation.title and relation.rel-entity-name as specified in
> the entity XML definition file.
>
> I did not quite understand this statement as it does not seem to make
sense
> in this context.  Is this parameter a concatination of "Payment" and
> "Method" where Payment is the relation.title and Method is the
> relation.rel-entity-name?
>
> I kinda dont think so.  I looked in the entitydef file containg Payment
and
> found this:
>
>       <relation type="one" fk-name="PAYMENT_PMETH"
> rel-entity-name="PaymentMethod">
>         <key-map field-name="paymentMethodId"/>
>       </relation>
>
> So, I am assuming that this particular getRelatedOne call is going to open
> the PaymentMethod entity and find the related "paymentMethodId" record.
>
> Is this correct?
>
> Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the
entity
> name to look in and xxxId is the key name in xxx always?
>
> Thanks
>
> Skip
>
>



Re: Still no response

Posted by Adrian Crum <ad...@hlmksw.com>.
Scott replied to your message. Did you miss it?

skip@theDevers wrote:

> I asked this question yesterday, but got no response.  Is there someone out
> there with entity engine knowledge?
> 
> I have this bit of code:
> 
>             GenericValue payment = delegator.findByPrimaryKey("Payment",
> UtilMisc.toMap("paymentId", paymentId));
> ...
>             GenericValue paymentMethod =
> payment.getRelatedOne("PaymentMethod");
> 
> The javadoc for getRelatedOne sez:
> 
> Parameters:
>     relationName - String containing the relation name which is the
> combination of relation.title and relation.rel-entity-name as specified in
> the entity XML definition file.
> 
> I did not quite understand this statement as it does not seem to make sense
> in this context.  Is this parameter a concatination of "Payment" and
> "Method" where Payment is the relation.title and Method is the
> relation.rel-entity-name?
> 
> I kinda dont think so.  I looked in the entitydef file containg Payment and
> found this:
> 
>       <relation type="one" fk-name="PAYMENT_PMETH"
> rel-entity-name="PaymentMethod">
>         <key-map field-name="paymentMethodId"/>
>       </relation>
> 
> So, I am assuming that this particular getRelatedOne call is going to open
> the PaymentMethod entity and find the related "paymentMethodId" record.
> 
> Is this correct?
> 
> Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the entity
> name to look in and xxxId is the key name in xxx always?
> 
> Thanks
> 
> Skip
> 
> 


Re: Still no response

Posted by BJ Freeman <bj...@free-man.net>.
Skip,
everyone here is a volunteer. There is no Active support personal(paid)
that supports this mailing list.
Most of those with the real deep knowledge are up to their necks in real
 jobs.

If you need immediate help and it is not here you might consider hiring
someone.



skip@theDevers sent the following on 10/9/2007 8:18 AM:
> I asked this question yesterday, but got no response.  Is there someone out
> there with entity engine knowledge?
> 
> I have this bit of code:
> 
>             GenericValue payment = delegator.findByPrimaryKey("Payment",
> UtilMisc.toMap("paymentId", paymentId));
> ...
>             GenericValue paymentMethod =
> payment.getRelatedOne("PaymentMethod");
> 
> The javadoc for getRelatedOne sez:
> 
> Parameters:
>     relationName - String containing the relation name which is the
> combination of relation.title and relation.rel-entity-name as specified in
> the entity XML definition file.
> 
> I did not quite understand this statement as it does not seem to make sense
> in this context.  Is this parameter a concatination of "Payment" and
> "Method" where Payment is the relation.title and Method is the
> relation.rel-entity-name?
> 
> I kinda dont think so.  I looked in the entitydef file containg Payment and
> found this:
> 
>       <relation type="one" fk-name="PAYMENT_PMETH"
> rel-entity-name="PaymentMethod">
>         <key-map field-name="paymentMethodId"/>
>       </relation>
> 
> So, I am assuming that this particular getRelatedOne call is going to open
> the PaymentMethod entity and find the related "paymentMethodId" record.
> 
> Is this correct?
> 
> Also, if I see a yyy.getRelatedOne(xxx), can I assume that xxx is the entity
> name to look in and xxxId is the key name in xxx always?
> 
> Thanks
> 
> Skip
> 
> 
> 
>