This file contains 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
import java.io.Serializable; | |
import java.time.LocalDateTime; | |
import javax.persistence.Column; | |
import javax.persistence.Embeddable; | |
import javax.persistence.EmbeddedId; | |
import javax.persistence.Entity; | |
import javax.persistence.EntityListeners; | |
import javax.persistence.Table; |
This file contains 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 jp.co.jackson; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import lombok.Getter; | |
import lombok.Setter; | |
public class SampleJackson1 { | |
private static ObjectMapper mapper = new ObjectMapper(); |
This file contains 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 jp.co.jackson; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import lombok.Getter; | |
import lombok.Setter; | |
public class SampleJackson1 { | |
private static ObjectMapper mapper = new ObjectMapper(); |
This file contains 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 jp.co.jackson; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import lombok.Getter; | |
import lombok.Setter; | |
import lombok.ToString; | |
public class SampleJackson1 { |
This file contains 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 jp.co.jackson; | |
import java.util.LinkedHashMap; | |
import java.util.List; | |
import java.util.Map; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.core.type.TypeReference; | |
import com.fasterxml.jackson.databind.ObjectMapper; |
This file contains 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 `m_emp` ( | |
`empno` bigint(20) NOT NULL AUTO_INCREMENT, | |
`empname` varchar(255) DEFAULT NULL, | |
`departmentid` varchar(10) DEFAULT NULL, | |
PRIMARY KEY (`empno`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1234567890123456790 DEFAULT CHARSET=utf8 |
This file contains 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
mysql> insert into m_emp (empno,empname,departmentid) values (null,'takahashi','101010'); | |
Query OK, 1 row affected (0.04 sec) |
This file contains 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
mysql> select * from m_emp; | |
+---------------------+------------+--------------+ | |
| empno | empname | departmentid | | |
+---------------------+------------+--------------+ | |
| 5 | 従業員A | 10101001 | | |
| 6 | 従業員B | 10101001 | | |
| 7 | 従業員C | 10101002 | | |
| 8 | 従業員D | 10101003 | | |
| 1234567890123456789 | NULL | NULL | | |
| 1234567890123456790 | takahashi | 101010 | |
This file contains 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
mysql> select last_insert_id(); | |
+---------------------+ | |
| last_insert_id() | | |
+---------------------+ | |
| 1234567890123456790 | | |
+---------------------+ | |
1 row in set (0.00 sec) |
This file contains 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
mysql> insert into m_emp (empno,empname,departmentid) values (3,'takahashi','101010'); ← empnoを3で指定する | |
Query OK, 1 row affected (0.29 sec) | |
mysql> select * from m_emp; | |
+---------------------+------------+--------------+ | |
| empno | empname | departmentid | | |
+---------------------+------------+--------------+ | |
| 3 | takahashi | 101010 | ← レコードが追加されている | |
| 5 | 従業員A | 10101001 | | |
| 6 | 従業員B | 10101001 | |
OlderNewer