1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
private static final String TABLE = "T_CATEGORY";
private static final String COLUMNS = "ID, NAME, DESCRIPTION";
public void insert(final PersistentObject object) throws DuplicateKeyException {
Connection connection = null;
Statement statement = null;
final Category category = (Category) object;
try {
connection = getConnection();
statement = connection.createStatement();
final String sql = "INSERT INTO " + TABLE + "(" + COLUMNS + ") VALUES ('" + category.getId() + "', '" + category.getName() + "','" + category.getDescription()+"' )";
statement.executeUpdate(sql);
//... |