Advertisement
Guest User

Untitled

a guest
Sep 7th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. CREATE PROCEDURE SP_INS_PAGEID(
  2. IN in_page_id bigint(20))
  3. MODIFIES SQL DATA
  4. BEGIN ATOMIC
  5. INSERT INTO NOTIFICATION VALUES (in_page_id);
  6.  
  7. END
  8.  
  9. <jdbc:embedded-database id="daqDS" type="HSQL" database-name="LEADGENDB">
  10. <jdbc:script location="classpath:db/create-db.sql" separator="@" />
  11. <jdbc:script location="classpath:db/insert-data.sql" />
  12. </jdbc:embedded-database>
  13.  
  14. private JdbcTemplate JdbcTemplate;
  15. private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  16.  
  17. @Autowired
  18. public void setDataSource(DataSource dataSource) {
  19. this.JdbcTemplate = new JdbcTemplate(dataSource);
  20. this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
  21. }
  22.  
  23. @Test
  24. public void testStoredProc() throws SQLException
  25. try{
  26. SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(JdbcTemplate).withProcedureName("SP_INS_PAGEID");
  27.  
  28. SqlParameterSource in = new MapSqlParameterSource() .addValue("in_page_id", 34);
  29. Map<String, Object> result = simpleJdbcCall.execute(in);
  30.  
  31. } catch (Exception e) {
  32. System.out.println(e.getMessage());
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement