commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spframe live <spring_a_...@yahoo.com>
Subject Problem with common DBUtil Bean
Date Mon, 20 Dec 2004 21:27:04 GMT

I have 
Table with these column name and types

INDEX_ID NUMBER,
DOCUMENT_TYPE VARCHAR2(3),
DATE_ENTERED DATE,

SELECT index_id, document_type, date_entered from MyTable;
and database has required data.
                
public MyBean class  { 

  public long index_ID        ;
  public String document_Type  ;
  public java.sql.Date date_Entered     ;
 
 public MyBean(){
    super();
 }
 
 public long getIndex_ID() {
  return index_ID;
 }
 public void setIndex_ID(long index_ID) {
  this.index_ID = index_ID;
 }
 
 
 
 public java.sql.Date getDate_Entered() {
  return this.date_Entered;
 }
 public void setDate_Entered(java.sql.Date date_Entered) {
  this.date_Entered = date_Entered;
 } 
 
 
 public String getDocument_Type() {
  return document_Type;
 }
 public void setDocument_Type(String document_Type) {
  this.document_Type =  document_Type;
 }
 
}

public SomeTestCalss {
 public void someTestmethod(){
  // some how got connetion/ result set statement this is tested ok
  callst.execute();
  //Casting the returned parameter, OracleTypes.CURSOR to a JDBC ResultSet
  rset = (ResultSet)callst.getObject(1);
  rset = StringTrimmedResultSet.wrap(rset);
  SqlNullCheckedResultSet sqlncrswrap = new SqlNullCheckedResultSet(rset);
    
  sqlncrswrap.setNullDate(null) ;
    sqlncrswrap.setNullInt(0) ;
    sqlncrswrap.setNullString(""); 
 
  rset = ProxyFactory.instance().createResultSet(sqlncrswrap);
  // Pass wrapped ResultSet to processor

   results = BasicRowProcessor.instance().toBeanList(rset,MyBean.class);

   Iterator iter = mciResults.iterator();
   while (iter.hasNext()) {
    MyBean mb = (MyBean) iter.next();
    System.out.println("Index ID"+mb.getIndex_ID());
    System.out.println("Document Type"+mb.getDocument_Type());
    System.out.println("date_entered "+mb.getDate_Entered());
    }
 }
}
 

output looks like this 
Index ID 0 
Document Type MYDOCTYPE 
Date entered null 

Why Index ID for all rows is 0 and Date entered for all rows is null while I can get Document
Type value correctly.


		
---------------------------------
Do you Yahoo!?
 Send a seasonal email greeting and help others. Do good.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message