title: how to pass a java object to oracle stored procedure with following details
body: <p>I have my ORACLE table with structure as </p>
  
  <pre><code>desc extraction_log1
             Name                           Null                        
                                                       Type                                                                                                                                                                                          
  
   ------------------------------ -------- ------------------------------------------------------------     ----------------------------------------------------------------------------------------------------      ----------------------------- 
   ROW_NUM                        NOT NULL            NUMBER                                                                                                                                                                                        
  DATE_TIME                                        TIMESTAMP(8)                                                                                                                                                                                  
  USER_NAME                                         VARCHAR2(32)                                                                                                                                                                                  
  PLATFORM_NAME                                      VARCHAR2(20)                                                                                                                                                                                  
  R_OBJECT_ID                                       VARCHAR2(16)   
  </code></pre>
  
  <p>Then I created an object type in oracle as  </p>
  
  <pre><code>create or replace type EXTRACTION_LOG_TYPE as object    (          
  
   USER_NAME VARCHAR2(32), 
   R_OBJECT_ID VARCHAR2(16), 
  
    );
  </code></pre>
  
  <p>Then I created procedure in a package as</p>
  
  <pre><code>create or replace package body PAC_BEAN is 
    --The insert procedure will receive EXTRACTION_LOG_TYPE and put it into table EXTRACTION_LOG1.  
  
     procedure PRO_INSERT_LOG(ELT in EXTRACTION_LOG_TYPE) is 
  
     begin 
  
        insert into EXTRACTION_LOG1 ( R_OBJECT_ID, USER_NAME)
             values (ELT.R_OBJECT_ID, ELT.USER_NAME);  
  
        commit;  
  
   exception  
  
    when others then 
      rollback;  
  
    end PRO_INSERT_LOG;  
    end PAC_BEAN; 
  </code></pre>
  
  <p>and coming to my java side I have declared a bean with</p>
  
  <pre><code>public class ExtractionLogType {        
          //Name declared in Oracle        
     public static final String ORACLE_OBJECT_NAME = "EXTRACTION_LOG_TYPE";            
     //The attributes        
    private String  R_OBJECT_ID;        
    private String USER_NAME;      
    //setters and getters      
    public  String getR_OBJECT_ID() {
      return R_OBJECT_ID;
    }
    public  void setR_OBJECT_ID(String rOBJECTID) {
      R_OBJECT_ID = rOBJECTID;
      }
    public  String getUSER_NAME() {
      return USER_NAME;
     }
    public  void setUSER_NAME(String uSERNAME) {
      USER_NAME = uSERNAME;
     }
  
  
              } 
  </code></pre>
  
  <p>in my Class containing main</p>
  
  <pre><code>               import java.sql.CallableStatement;
                 import java.sql.Connection;
                   import java.sql.DriverManager;
                 import java.sql.SQLException;
  
              public class DBLogger{     
            String dbUrl;     
          Connection con;      
       //constructor for creation of  connection object 
          as and when an object of DBLogger is instantiated     
          public DBLogger(){           
      dbUrl = "jdbc:oracle:thin@my url";        
           try {             
          //load Oracle Driver class             
          Class.forName("oracle.jdbc.driver.OracleDriver");     
          } catch (ClassNotFoundException e) {         
              e.printStackTrace();         
              System.err.println("Oracle driver class not found");       
              }      
          try {         
              //instantiate connection object       
              con = DriverManager.getConnectio (dbUrl,"userId","pwd");                
              } catch (SQLException e) {      
                  e.printStackTrace();                       
                System.err.println("Connection object to oracle cant be established");   
                  }    
              } 
          public static void main(String args[]){  
       try{
      DBLogger db=new DBLogger();        
      CallableStatement cs = null;        
      ExtractionLogType elt=new  ExtractionLogType();         
      elt.setR_OBJECT_ID("79479479A900");       
      elt.setUSER_NAME("Jeevan");               
      cs = db.con.prepareCall("{call PAC_BEAN.PRO_INSERT_LOG(?)}");                
      /*                     
       * *code to insert the above object into our Database               
       *       
      */
      cs.execute();           
      System.out.println("insert procedure executed successfully");                  
      db.con.close();      
      }  //end try  
  catch (SQLException e) {      
      e.printStackTrace();   }     
  catch(Exception e) {             e.printStackTrace();        
  }   
  }
  
         }         
  </code></pre>
  
  <p>I can't figure out the code to make the object get inserted into my database.<br>
  can anyone suggest me regarding this.</p>
  
  <p>Thank You.</p>