ca.krasnay.sqlbuilder
Class InsertCreator

java.lang.Object
  extended by ca.krasnay.sqlbuilder.InsertCreator
All Implemented Interfaces:
Serializable, org.springframework.jdbc.core.PreparedStatementCreator

public class InsertCreator
extends Object
implements org.springframework.jdbc.core.PreparedStatementCreator, Serializable

A Spring PreparedStatementCreator that you can use like an InsertBuilder. Example usage is as follows:

 PreparedStatementCreator psc = new InsertCreator("emp").setRaw("id", "emp_id_seq.nextval").setValue("name",
         employee.getName());

 new JdbcTemplate(dataSource).update(psc);
 

Author:
John Krasnay
See Also:
Serialized Form

Constructor Summary
InsertCreator(String table)
           
 
Method Summary
 PreparedStatement createPreparedStatement(Connection conn)
           
 ParameterizedPreparedStatementCreator setParameter(String name, Object value)
           
 InsertCreator setRaw(String column, String value)
           
 InsertCreator setValue(String column, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsertCreator

public InsertCreator(String table)
Method Detail

createPreparedStatement

public PreparedStatement createPreparedStatement(Connection conn)
                                          throws SQLException
Specified by:
createPreparedStatement in interface org.springframework.jdbc.core.PreparedStatementCreator
Throws:
SQLException

setParameter

public ParameterizedPreparedStatementCreator setParameter(String name,
                                                          Object value)

setRaw

public InsertCreator setRaw(String column,
                            String value)

setValue

public InsertCreator setValue(String column,
                              Object value)


Copyright © 2014. All rights reserved.