@Override protected void initDao() throws Exception { super.initDao(); insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no", "team", "week", "opponent", " completes", "attempts", "passing_yards", "passing_td", "interceptions", "rushes", "rush_yards", "receptions", "receptions_yards", "total_td"); }
@Override protected void initDao() throws Exception { super.initDao(); insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no", "team", "week", "opponent", " completes", "attempts", "passing_yards", "passing_td", "interceptions", "rushes", "rush_yards", "receptions", "receptions_yards", "total_td"); }
@Test public void testNoSuchTable() throws Exception { ResultSet resultSet = mock(ResultSet.class); given(resultSet.next()).willReturn(false); given(databaseMetaData.getDatabaseProductName()).willReturn("MyDB"); given(databaseMetaData.getDatabaseProductName()).willReturn("MyDB"); given(databaseMetaData.getDatabaseProductVersion()).willReturn("1.0"); given(databaseMetaData.getUserName()).willReturn("me"); given(databaseMetaData.storesLowerCaseIdentifiers()).willReturn(true); given(databaseMetaData.getTables(null, null, "x", null)).willReturn(resultSet); SimpleJdbcInsert insert = new SimpleJdbcInsert(dataSource).withTableName("x"); // Shouldn't succeed in inserting into table which doesn't exist thrown.expect(InvalidDataAccessApiUsageException.class); try { insert.execute(new HashMap<>()); } finally { verify(resultSet).close(); } }
public PaymentWriter(DataSource dataSource) { paymentInsert = new SimpleJdbcInsert(dataSource) .withTableName("PAYMENTS") .usingColumns("RECIPIENT", "PAYEE", "AMOUNT", "PAY_DATE"); accountUpdate = new JdbcTemplate(dataSource); }
public PaymentWriter(DataSource dataSource) { paymentInsert = new SimpleJdbcInsert(dataSource) .withTableName("PAYMENTS") .usingColumns("RECIPIENT", "PAYEE", "AMOUNT", "PAY_DATE"); accountUpdate = new JdbcTemplate(dataSource); }
public PaymentWriter(DataSource dataSource) { paymentInsert = new SimpleJdbcInsert(dataSource) .withTableName("PAYMENTS") .usingColumns("RECIPIENT", "PAYEE", "AMOUNT", "PAY_DATE"); accountUpdate = new JdbcTemplate(dataSource); }
public PaymentWriter(DataSource dataSource) { paymentInsert = new SimpleJdbcInsert(dataSource) .withTableName("PAYMENTS") .usingColumns("RECIPIENT", "PAYEE", "AMOUNT", "PAY_DATE"); accountUpdate = new JdbcTemplate(dataSource); }
public PosterityDao(DataSource dataSource) { this.dataSource = dataSource; this.jdbcTemplate = new JdbcTemplate(dataSource); this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); this.jdbcInsert = new SimpleJdbcInsert(dataSource); this.jdbcCall = new SimpleJdbcCall(dataSource); }
JobConfigurationParameterDAO(final JdbcTemplate jdbcTemplate, final String tableName, final String schema) { this.jdbcTemplate = jdbcTemplate; this.tableName = tableName; this.simpleJdbcInsert = new SimpleJdbcInsert(jdbcTemplate) .withSchemaName(schema) .withTableName(String.format(TABLE_NAME, tableName)) .usingGeneratedKeyColumns(JobConfigurationParameterDomain.ID); this.dateFormat = new SimpleDateFormat(DomainParameterParser.DATE_FORMAT_WITH_TIMESTAMP); }
@SuppressWarnings("SpringJavaAutowiringInspection") @Autowired public JDBCDataRepositoryImpl(NamedParameterJdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; this.insertIntoProject = new SimpleJdbcInsert((JdbcTemplate) jdbcTemplate.getJdbcOperations()) .withTableName("project") .usingGeneratedKeyColumns("pid"); }
public JdbcPurchaseOrderDao(DataSource dataSource) { insert = new SimpleJdbcInsert(dataSource) .withTableName("PURCHASE_ORDER") .usingGeneratedKeyColumns("PURCHASE_ORDER_ID") .usingColumns("ITEM_ID", "PAYMENT_INFO_ID", "ADDRESS"); }
public JdbcPaymentInfoDao(DataSource dataSource) { insert = new SimpleJdbcInsert(dataSource) .withTableName("PAYMENT_INFO") .usingGeneratedKeyColumns("PAYMENT_INFO_ID") .usingColumns("PRICE"); }
JobConfigurationDAO(final JdbcTemplate jdbcTemplate, final String tableName, final String schema) { this.jdbcTemplate = jdbcTemplate; this.tableName = tableName; this.simpleJdbcInsert = new SimpleJdbcInsert(jdbcTemplate) .withSchemaName(schema) .withTableName(String.format(TABLE_NAME, tableName)).usingGeneratedKeyColumns( JobConfigurationDomain.JOB_CONFIGURATION_ID); this.jobConfigurationRowMapper = new JobConfigurationRowMapper(); this.jobConfigurationJdbcWrapperRowMapper = new JobConfigurationJdbcWrapperRowMapper(this.jobConfigurationRowMapper); }
public SimpleInsertMessageDao(DataSource dataSource) { simpleInsert = new SimpleJdbcInsert(dataSource); simpleInsert.withTableName("guestmessage") .usingColumns("name", "message", "creationTime") .setGeneratedKeyName("id"); delegate = new JdbcTemplateMessageDao(dataSource); }
@Autowired(required = true) public void initialize(final DataSource dataSource) { this.jdbcTemplate = new SimpleJdbcTemplate(dataSource); this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books") .usingGeneratedKeyColumns("id"); }
@Autowired(required = true) public void initialize(final DataSource dataSource) { this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books") .usingGeneratedKeyColumns("id"); }
@Autowired(required = true) public void initialize(final DataSource dataSource) { this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books") .usingGeneratedKeyColumns("id"); }
@Autowired(required = true) public void initialize(final DataSource dataSource) { this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books") .usingGeneratedKeyColumns("id"); }
private InsertBatchOperate newInsertBatch(Insert insert, boolean autoGeneratedKeys) { TableMetaData metaData = provider.generatedKeyNamesWithMetaData( jdbcTemplate.getDataSource(), insert.getContext().getSchema(), null, insert.getContext().getTableName()); SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(jdbcTemplate); return new InsertBatchOperate(autoGeneratedKeys, insert, metaData, simpleJdbcInsert, this); }
protected BaseSpringJdbcRepository(JdbcTemplate jdbcTemplate, SqlGenerator sqlGenerator) { this.sqlGenerator = sqlGenerator; this.jdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate); this.jdbcInsert = new SimpleJdbcInsert(jdbcTemplate) .withTableName(entityMeta.getTable()) .usingGeneratedKeyColumns(entityMeta.getIdColumnName()); this.rowMapper = createRowMapper(entityMeta.getClassType()); }