This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS CONTACT; | |
CREATE TABLE CONTACT ( | |
ID INT NOT NULL AUTO_INCREMENT | |
, FIRST_NAME VARCHAR(60) NOT NULL | |
, LAST_NAME VARCHAR(40) NOT NULL | |
, BIRTH_DATE DATE | |
, DESCRIPTION VARCHAR(2000) | |
, PHOTO BLOB | |
, VERSION INT NOT NULL DEFAULT 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into contact (first_name, last_name, birth_date) values ('Clarence', 'Ho', '1980-07-30'); | |
insert into contact (first_name, last_name, birth_date) values ('Scott', 'Tiger', '1990-11-02'); | |
insert into contact (first_name, last_name, birth_date) values ('John', 'Smith', '1964-02-28'); | |
insert into contact (first_name, last_name, birth_date) values ('Peter', 'Jackson', '1944-1-10'); | |
insert into contact (first_name, last_name, birth_date) values ('Jacky', 'Chan', '1955-10-31'); | |
insert into contact (first_name, last_name, birth_date) values ('Susan', 'Boyle', '1970-05-06'); | |
insert into contact (first_name, last_name, birth_date) values ('Tinner', 'Turner', '1967-04-30'); | |
insert into contact (first_name, last_name, birth_date) values ('Lotus', 'Notes', '1990-02-28'); | |
insert into contact (first_name, last_name, birth_date) values ('Henry', 'Dickson', '1997-06-30'); | |
insert into contact (first_name, last_name, birth_date) values ('Sam', 'Davis', '2001-01-31'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.apress.prospring3.ch17.service; | |
import java.util.List; | |
import org.springframework.data.domain.Page; | |
import org.springframework.data.domain.Pageable; | |
import com.apress.prospring3.ch17.domain.Contact; | |
public interface ContactService { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.app; | |
import org.springframework.context.support.GenericXmlApplicationContext; | |
import com.company.app.annotation.dao.ContactSfDao; | |
public class JdbcContactSfDaoTest { | |
public static void main(String[] args) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.app.annotation.dao; | |
public interface ContactSfDao { | |
public String getFirstNameById(Long id); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.app.annotation.dao; | |
import java.util.List; | |
import javax.annotation.Resource; | |
import javax.sql.DataSource; | |
import org.springframework.stereotype.Repository; | |
import com.company.app.annotation.procedure.SfFirstNameById; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.app.annotation.procedure; | |
import java.sql.Types; | |
import javax.sql.DataSource; | |
import org.springframework.jdbc.core.SqlParameter; | |
import org.springframework.jdbc.object.SqlFunction; | |
public class SfFirstNameById extends SqlFunction<String> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | |
<description>JDBC Pool con DataSource MySQL y StoredProcedure</description> | |
<import resource="datasource-dbcp.xml"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.1.xsd"> | |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" | |
destroy-method="close"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdbc.driverClassName=com.mysql.jdbc.Driver | |
jdbc.url=jdbc:mysql://54.172.6.102:3306/spring | |
jdbc.username=fractalystlab | |
jdbc.password=fractalystlab |