You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Keshava Murthy <ke...@bigtec.org> on 2003/02/12 08:56:28 UTC

problem with sql query

Hi ,

The following method in screen class returns the data without any problem if
the database used is Oracle 8i and when I change the database to mysql or MSSQL the
method returns null value.

private Vector getPatientRegnData(){
 try
 {
 String strPin="1";
 String strEncNo="1";
 Criteria criteria          =  new Criteria();

criteria.addJoin(HisMasPatregnPeer.IPAT_INO_PREG,HisTrxPatrevisitPeer.IPAT_I
NO_PREG);

/* columns from his_mas_patregn table /*

 criteria.addSelectColumn(HisMasPatregnPeer.SPAT_FNAME_PREG);
 criteria.addSelectColumn(HisMasPatregnPeer.SPAT_MNAME_PREG );

/* columns from his_trx_patrevisit table /*

 criteria.addSelectColumn(HisTrxPatrevisitPeer.IPAT_ENCNO_PRVT);
 criteria.addSelectColumn(HisTrxPatrevisitPeer.DTPAT_RVTDTTM_PRVT);

 Criteria.Criterion a1  =
criteria.getNewCriterion(HisMasPatregnPeer.IPAT_INO_PREG,strPin,Criteria.LIK
E);
 Criteria.Criterion b1  =
criteria.getNewCriterion(HisTrxPatrevisitPeer.IPAT_ENCNO_PRVT,strEncNo,Crite
ria.LIKE);
 criteria.add(a1.and(b1));
  return HisMasPatregnPeer.doPSSelect(criteria);
 }
 catch (Exception e)
 {
 return null;
}
}

I also did some debugging and found that if I comment columns from
his_trx_patrevisit table the method returns vector conatins data.
I also checked the sql query generated(criteria.toString()) from mysql
prompt and it returns proper data, which means that addjoin query is not
working in mysql/mssql and it is working properly when oracle is the database
when application is run.

My question is why it is returning vector containg null  when I use mysql as
database?

regards,
Keshava Murthy. S