Hello Friends,

I am trying to call a java class from Form widget.

----------------------------Form
Widget-------------------------------------------------
<display
description="${bsh:com.opensourcestrategies.financials.reports.ReportHelper.getOrderSubTotal(delegator,
OTCMOrderNo)}"/>

-------------------------------------------------

my Java class 

-------------------------------------------------

 public static String getOrderSubTotal(GenericDelegator delegator, String
OTCMOrderNo) {
        List subTotalObject = null;
        
        EntityExpr condition = new EntityExpr("OTCMOrderNo",
EntityOperator.EQUALS,OTCMOrderNo);
        
        try {
                //subTotalObject =
delegator.findByPrimaryKey("OrderAndTaxByCounty",
UtilMisc.toMap("OTCMOrderNo", OTCMOrderNo));
                
                
                subTotalObject = 
delegator.findByCondition("OrderAndTaxByCounty",
condition, null, null);
                
        } catch (GenericEntityException e) {
            Debug.logError(e, "Error finding OrderAndTaxByCounty in
getPartyName", module);
        }
        
        String subTotal = String.valueOf(subTotalObject);
        return subTotal;
        
    }
-------------------------------------------------

I am getting "Null" in return. And Getting following error in my log file.
-------------------------------------------------------------------------
Error finding OrderAndTaxByCounty in getPartyName
Exception: org.ofbiz.entity.transaction.GenericTransactionException
Message: The current transaction is marked for rollback, not beginning a new
transaction and aborting current operation; the rollbackOnly was caused by:
Failure in findByPrimaryKey operation for entity [OrderAndTaxByCounty]:
org.ofbiz.entity.GenericModelException: [GenericDelegator.findByPrimaryKey]
Passed primary key is not a valid primary key:
[GenericEntity:OrderAndTaxByCounty][OTCMOrderNo,ORD143486(java.lang.String)].
Rolling back transaction.org.ofbiz.entity.GenericModelException:
[GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
primary key:
[GenericEntity:OrderAndTaxByCounty][OTCMOrderNo,ORD143486(java.lang.String)]
([GenericDelegator.findByPrimaryKey] Passed primary key is not a valid
primary key:
[GenericEntity:OrderAndTaxByCounty][OTCMOrderNo,ORD143486(java.lang.String)])
-------------------------------------------------------------------------

OTCMOrderNo is one my primary key (there are total 5 primary keys) in
view-entity. 

Does anybody has idea whats wrong with my code?

I also dont know why the error is pointing to findByPrimaryKey as I have
used findByCondition with the delgator in my java class.

I really appreciate the help.

Thank you in advance.
Su-
-- 
View this message in context: 
http://www.nabble.com/Error-in-finding-view-entity-tp25670090p25670090.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to