Previous Topic Next topic Print topic


Sample Initialize Method

The code for the initialize method is as follows:

private void initialize(
                 javax.resource.cci.Connection con,
                 javax.resource.cci.ConnectionFactory cf,
                 boolean isInitial) {
      try {
      javax.resource.cci.Interaction ix = 
           con.createInteraction();
      com.microfocus.cobol.connector.cci.CobolInteractionSpec 
           iSpec = new 
           com.microfocus.cobol.connector.cci.CobolInteractionSpec();
      iSpec.setFunctionName("initialize");
      javax.resource.cci.RecordFactory rf = 
           cf.getRecordFactory();
      javax.resource.cci.IndexedRecord irec = 
           rf.createIndexedRecord("beanArgs");
      irec.add(new Boolean(isInitial));
      javax.resource.cci.Record orec = 
           ix.execute(iSpec, irec);
      ix.close();
   } catch(javax.resource.ResourceException ex) {
      throw new javax.ejb.EJBException(
           "initialize threw ResourceException: ", ex);
   }
}
Previous Topic Next topic Print topic