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.pig.database.databasedemo.jdbc; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.jdbc.core.BeanPropertyRowMapper; //new!! 來自Spring | |
| import org.springframework.jdbc.core.JdbcTemplate; //new!! 來自Spirng | |
| import org.springframework.stereotype.Repository; |
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.pig.database.databasedemo; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.CommandLineRunner; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; |
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.pig.database.databasedemo.entity; | |
| import java.util.Date; | |
| public class Person { | |
| private int id; | |
| private String name; | |
| private String location; | |
| private Date birthDate; | |
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.pig.database.databasedemo.jdbc; | |
| import java.sql.Timestamp; | |
| import java.util.Date; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.jdbc.core.BeanPropertyRowMapper; //new!! 來自Spring | |
| import org.springframework.jdbc.core.JdbcTemplate; //new!! 來自Spirng |
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.pig.database.databasedemo; | |
| import java.util.Date; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.CommandLineRunner; | |
| import org.springframework.boot.SpringApplication; |
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.pig.database.databasedemo.jdbc; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.sql.Timestamp; | |
| import java.util.Date; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.springframework.beans.factory.annotation.Autowired; |
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.pig.database.databasedemo.entity; | |
| import java.util.Date; | |
| import javax.persistence.Entity; | |
| import javax.persistence.GeneratedValue; | |
| import javax.persistence.Id; | |
| @Entity | |
| public class Person { |
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.pig.database.databasedemo.jpa; | |
| import javax.persistence.EntityManager; | |
| import javax.persistence.PersistenceContext; | |
| import javax.transaction.Transactional; | |
| import org.springframework.stereotype.Repository; | |
| import com.pig.database.databasedemo.entity.Person; |
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.pig.database.databasedemo; | |
| import java.util.Date; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.CommandLineRunner; | |
| import org.springframework.boot.SpringApplication; |
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
| /* | |
| create table person | |
| ( | |
| id integer not null, | |
| name varchar (255) not null, | |
| location varchar(255), | |
| birth_date timestamp, | |
| primary key(id) | |
| ); | |
| */ |