Hi all,

I'm having issue trying to select a view entity field from within another
view entity.

I have to view entity currently, first one looks like this:

<view-entity entity-name="ViewOfficerPaymentInfo"
package-name="com.trideas.ams.payment" title="OfficerPayment joins
OfficerPaymentCommission">
      <member-entity entity-alias="OP" entity-name="OfficerPayment"/>
      <member-entity entity-alias="PC"
entity-name="OfficerPaymentCommission"/>
      <alias entity-alias="OP" name="paymentId" />
      <alias entity-alias="OP" name="officerId"/>

      <view-link entity-alias="OP" rel-entity-alias="PC">
        <key-map field-name="paymentId"/>
      </view-link>
    </view-entity>


The second one:

<view-entity entity-name="ViewOfficerSalesReport"
package-name="com.trideas.ams.customer" title="Customer tables joined with
outer joins the Payment table for Officer Sales report">
      <member-entity entity-alias="PI" entity-name="CustomerPersonalInfo"/>
      <member-entity entity-alias="FD"
entity-name="CustomerFinancingDetails"/>
      <member-entity entity-alias="VP"
entity-name="ViewOfficerPaymentInfo"/>
      <alias entity-alias="PI" name="customerId" field="customerId" />
      <alias entity-alias="PI" name="customerName" field="name" />
      <alias entity-alias="FD" name="officerId" field="marketingOfficerId"
/>
      <alias entity-alias="VP" name="opBankId" field="opBankId"/>
      <alias entity-alias="VP" name="opAccNo" field="opAccNo"/>
      <alias entity-alias="VP" name="opPaymentDate" field="opPaymentDate" />
      <alias entity-alias="VP" name="opChequeNo" field="opChequeNo" />
      <alias entity-alias="FD" name="loanApproved" field="loanApproved" />
      <alias entity-alias="FD" name="approvedDate" field="approvedDate" />
      <alias entity-alias="PI" name="createdDate" field="createdDate" />
      <view-link entity-alias="PI" rel-entity-alias="FD">
        <key-map field-name="customerId"/>
      </view-link>
      <view-link entity-alias="FD" rel-entity-alias="VP"
rel-optional="true">
        <key-map field-name="customerId" rel-field-name="customerId"/>
        <key-map field-name="marketingOfficerId"
rel-field-name="officerId"/>
      </view-link>
    </view-entity>

When i try to use a entity-condition to select the entity, i found that i
can't select the opBankId and whatever else field from the VP view. There's
a warning message in the log that says:

"The field name (or key) [opBankId] is not valid for entity
[ViewOfficerSalesReport], printing IllegalArgumentException instead of
throwing it because Map interface specification does not allow throwing
that exception."

I did a logging and found that the SQL itself is correct bar that the
fields from the view is not selected:-

SELECT PI.CUSTOMER_ID, PI.NAME, FD.MARKETING_OFFICER_ID, FD.LOAN_APPROVED,
FD.APPROVED_DATE, PI.CREATED_DATE
FROM ((public.CUSTOMER_PERSONAL_INFO PI
INNER JOIN public.CUSTOMER_FINANCING_DETAILS FD ON PI.CUSTOMER_ID =
FD.CUSTOMER_ID)
LEFT OUTER JOIN (
SELECT OP.PAYMENT_ID AS OP_PAYMENT_ID, OP.OFFICER_ID AS OP_OFFICER_ID,
OP.PAYMENT_DATE AS OP_PAYMENT_DATE, OP.BANK_ID AS OP_BANK_ID, OP.ACC_NO AS
OP_ACC_NO, OP.CHEQUE_NO AS OP_CHEQUE_NO,
PC.CUSTOMER_ID AS PC_CUSTOMER_ID FROM public.OFFICER_PAYMENT OP INNER JOIN
public.OFFICER_PAYMENT_COMMISSION PC ON OP.PAYMENT_ID = PC.PAYMENT_ID) VP
ON FD.CUSTOMER_ID = VP.PC_CUSTOMER_ID AND FD.MARKETING_OFFICER_ID =
VP.OP_OFFICER_ID)
WHERE ((PI.NAME LIKE '%'))
ORDER BY FD.APPROVED_DATE DESC

The reason i'm putting the VP field with the prefix 'op' is because i'm
trying to let it select the fields, but it doesn't work.

Anyone have any idea how this should work? Is there something i should add
to the alias so that it will select those fields?

Thanx
FooShyn

Reply via email to