List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:com.dai.dao.TreinoDaoImpl.java
@Override public void updateTreino(Treino treino) { String sql = "UPDATE treino set duracaoTreino = ?, localTreino = ?, dataTreino = ?, tipoTreino = ?, horaTreino = ?, escalao_idEscalao_t = ?" + " where idTreino = ?"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.update(sql,// www . j a va 2 s .co m new Object[] { treino.getDuracaoTreino(), treino.getLocalTreino(), treino.getDataTreino(), treino.getTipoTreino(), treino.getHoraTreino(), treino.getIdEscalao(), treino.getIdTreino() }); }
From source file:locksdemo.JdbcLockServiceTests.java
@Before public void init() { super.init(); service.setExpiry(30000); new JdbcTemplate(dataSource).update("DELETE FROM LOCKS"); }
From source file:com.googlecode.flyway.core.dbsupport.postgresql.PostgreSQLMigrationMediumTest.java
/** * Tests clean and migrate for PostgreSQL Stored Procedures. *//*from ww w. j ava 2 s . c o m*/ @Test public void storedProcedure() throws Exception { flyway.setBaseDir("migration/dbsupport/postgresql/sql/procedure"); flyway.migrate(); JdbcTemplate jdbcTemplate = new JdbcTemplate(migrationDataSource); assertEquals("Hello", jdbcTemplate.queryForObject("SELECT value FROM test_data", String.class)); flyway.clean(); // Running migrate again on an unclean database, triggers duplicate object exceptions. flyway.migrate(); }
From source file:io.github.benas.jql.core.IndexerTest.java
@Before public void setUp() throws Exception { File databaseDirectory = new File("target").getAbsoluteFile(); sourceCodeDirectory = new File("src/test/java/io/github/benas/jql/code").getAbsoluteFile(); indexer = new Indexer(databaseDirectory); jdbcTemplate = new JdbcTemplate(getDataSourceFrom(databaseDirectory)); }
From source file:com.gst.portfolio.note.service.NoteReadPlatformServiceImpl.java
@Autowired public NoteReadPlatformServiceImpl(final RoutingDataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); }
From source file:org.smigo.comment.JdbcCommentDao.java
@Autowired public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.insert = new SimpleJdbcInsert(dataSource).withTableName("COMMENTS").usingGeneratedKeyColumns("ID") .usingColumns("TEXT", "SUBMITTER_USER_ID", "RECEIVER_USER_ID", "YEAR", "UNREAD"); }
From source file:com.seajas.search.utilities.spring.security.dao.UserDAO.java
/** * Initialize the database tables./*from w ww .j a v a 2 s.co m*/ * * @param dataSource */ @Autowired public UserDAO(final DataSource dataSource) { this.jdbc = new JdbcTemplate(dataSource); try { this.jdbc.execute( "CREATE TABLE user (id INT IDENTITY, username VARCHAR(255), password VARCHAR(255), fullname VARCHAR(255), is_enabled INTEGER DEFAULT 1)"); } catch (DataAccessException e) { if (logger.isDebugEnabled()) logger.debug("Table 'user' likely already exists as it could not be created"); } }
From source file:com.thinkbiganalytics.schema.QueryRunner.java
/** * Constructs a {@code QueryRunner} for the specified JDBC data source. *///from w ww . j a v a 2 s . c o m public QueryRunner(@Nonnull final DataSource dataSource) { this(new JdbcTemplate(dataSource)); }
From source file:ctv.stageissue.Application.java
@Bean @Autowired public JdbcTemplate jdbcTemplate(DataSource dataSource) { return new JdbcTemplate(dataSource); }
From source file:io.github.benas.jql.core.Indexer.java
public Indexer(File databaseDirectory) { DataSource dataSource = getDataSourceFrom(databaseDirectory); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); this.databaseDirectory = databaseDirectory; databaseInitializer = new DatabaseInitializer(databaseDirectory); CompilationUnitIndexer compilationUnitIndexer = getCompilationUnitIndexer(jdbcTemplate); entityIndexer = new EntityIndexer(compilationUnitIndexer); TypeDao typeDao = new TypeDao(jdbcTemplate); relationCalculator = new RelationCalculator( new ExtendsRelationCalculator(typeDao, new ExtendsDao(jdbcTemplate)), new ImplementsRelationCalculator(typeDao, new ImplementsDao(jdbcTemplate)), new AnnotatedWithCalculator(typeDao, new AnnotatedWithDao(jdbcTemplate))); }