1 23 24 26 27 package sample; 28 29 import javax.naming.*; 30 import javax.resource.cci.*; 31 import java.util.Iterator ; 32 import javax.resource.ResourceException ; 33 34 public class SampleBeanScenario { 35 36 public void method() { 37 38 try { 39 Context nc = new InitialContext(); 40 41 ConnectionFactory cf = (ConnectionFactory)nc.lookup( 43 "java:comp/env/eis/ConnectionFactory"); 44 Connection cx = cf.getConnection(); 45 46 Interaction ix = cx.createInteraction(); 48 49 InteractionSpecImpl ixSpec = new InteractionSpecImpl(); 51 ixSpec.setFunctionName("<NAME OF FUNCTION>"); 52 ixSpec.setInteractionVerb(InteractionSpec.SYNC_SEND_RECEIVE); 53 54 RecordFactory rf = cf.getRecordFactory(); 56 57 MappedRecord input = rf.createMappedRecord("Name of Record"); 59 input.put("<key: element1>", new String ("<VALUE1>")); 60 input.put("<key: element2>", new String ("<VALUE2>")); 61 62 EmployeeRecord employee = new EmployeeRecordImpl(); 64 65 ix.execute(ixSpec, input, employee); 67 68 System.out.println( employee.getName() + ":" + 70 employee.getId()); 71 } 72 catch (NamingException ne) { 73 return; 74 } 75 catch (ResourceException e) { 76 return; 77 } 78 } 79 80 81 public static void main(String [] args) { 82 } 83 84 } 85 | Popular Tags |