Logo of Bento frameworkspaceObject Oriented Programming


Source code example of Simple DAO Helper Part 1


  // Let's try DaoHelperForJndi, which creates
  // PreparedStatement from JNDI DataSource.
  // JNDI DataSource name must be available as the
  // environment valuable.
  String className="com.oopreserch.dao.DaoHelperForJndi";
  SimpleDaoHelper helper
     =DaoHelperFactory.getDaoHelper(className);

  // Please specify your SQL statement here...
  String insert="INSERT INTO example (id,name,age) VALUES(?,?,?)";
  QueryData query=new QueryData(insert);

  // Specify the values to be set on the SQL statement.
  // The order is important!
  query.addInt(50);
  query.addString("John Dow");
  query.addInt(30);

  // Its time to execute your SQL statement...
  int result=helper.update(query);


Copyright © 1997-2007 OOP-Research CorporationTM, All Rights Reserved.