2

I was working after forking Adempiere project and while working on patches when I create list from table with the list() method , instead of the specific class list I am getting Generic PO list. Can working on patches be the sore cause of this error.

Here is the code

    @Override
protected String doIt() throws Exception {


    int orgId = Env.getAD_Org_ID(getCtx());
    int clientID=Env.getAD_Client_ID(getCtx());

    List<MEmployee> EmployeeList = new ArrayList<MEmployee>();

    EmployeeList =  getEmployeeList(p_MemberGroupId,orgId);
    String msg  =   "";
    for ( MEmployee employee : EmployeeList )   {

    }

    return null;
}


private List<MEmployee> getEmployeeList(int EmployeeGroupID, int orgId) {

    List<MEmployee> employeeList =  new ArrayList<MEmployee>();

    StringBuffer employeeWhereClause =  new StringBuffer();



        employeeWhereClause.append( MEmployeeGroup.COLUMNNAME_E2_HR_PAGRP_ID )
                .append( " = " ).append( EmployeeGroupID )
                .append(" and ")
                .append( MEmployee.COLUMNNAME_AD_Org_ID)
                .append( " = " )
                .append(orgId)
                .append( " and " )
                .append( X_E2_HR_PAEM0.COLUMNNAME_Status )
                .append( " not in " )
                .append(" ('"+MEmployee.EMPSTATUS_OnHold+"','"+MEmployee.EMPSTATUS_Left+"') ");

        employeeList =  new Query(getCtx(), MEmployee.Table_Name, employeeWhereClause.toString(), get_TrxName())
                                .setClient_ID()
                                .setOnlyActiveRecords(Boolean.TRUE)
                                .list();
    return employeeList;
}

Here I am getting Generic PO List instead of MEmployee Type List.

Jud
  • 1,324
  • 3
  • 24
  • 47
JavaDragon
  • 431
  • 1
  • 6
  • 17

1 Answers1

0

I found the answer to this problem , basically Employee table is lets say ABC_Emp and my model classes for this ABC_Emp is generated, and MEmployee extend this X_ABC_Emp and implement DocAction Class and hence it is not generating list.

What i did, was instead of using MEmployee i used the model class X_ABC_Emp instead and tried list generation, and it worked. I don't know the reason exactly why MEmployee extending X_ABC_Emp didn't worked but this pretty much solved my problem.

JavaDragon
  • 431
  • 1
  • 6
  • 17