๐2022-08-12๐
mysql
local ๊ณ์ ctrl + enter
root ๊ณ์
์ถ์ถ๊ฐ
mysql ๋ฒ์ ํ์ธ 8.0.29
Persistence Framework
์ง์์ฑ ํ๋ ์์ํฌ
์ง์์ฑ ํ๋ ์์ํฌ(Persistence Framework)๋ ๋ฐ์ดํฐ์ ์ ์ฅ, ์กฐํ, ๋ณ๊ฒฝ, ์ญ์ ๋ฅผ ๋ค๋ฃจ๋ ํด๋์ค ๋ฐ ์ค์ ํ์ผ๋ค์ ์งํฉ์ด๋ค. ์ง์์ฑ ํ๋ ์์ํฌ๋ฅผ ์ฌ์ฉํ๋ฉด JDBC ํ๋ก๊ทธ๋๋ฐ์ ๋ณต์กํจ์ด๋ ๋ฒ๊ฑฐ๋ก์ ์์ด ๊ฐ๋จํ ์์ ๋ง์ผ๋ก ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฐ๋๋๋ ์์คํ ์ ๋น ๋ฅด๊ฒ ๊ฐ๋ฐํ ์ ์์ผ๋ฉฐ ์์ ์ ์ธ ๊ตฌ๋๋ ๋ณด์ฅํ๋ค.
1) SQL mapping
IDํ๊ณ sql ๋งคํํด์ ์ฐ๋ ๊ฑฐ . ๋ํ์ ์ผ๋ก MyBatis๊ฐ ์๋ค. ์ฐ๋ฆฌ๋ ์ด๊ฒ์ ์ธ ๊ฒ
2) ORM(Object Relation Mapping)
์์ฆ ๊ฐ๊ด๋ฐ๋ ๋ฐฉ๋ฒ. ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ํ๋์ ๋ ์ฝ๋๋ฅผ VO ํด๋์ค ์ฒ๋ผ ํ๋์ ๊ฐ์ฒด๋ก ๋ค๊ณ ์จ๋ค. ์ฌ์ฉ์๋ ์ฟผ๋ฆฌ๋ฌธ์ ์ฐ๋๊ฒ ์๋๋ผ ๊ฐ์ฒด์ setter getter๋ฅผ ์ฌ์ฉํ๋ค. ํ๋ก๊ทธ๋๋จธ ์ ์ฅ์์๋ ์ฟผ๋ฆฌ๋ฌธ์ ์ ํ ์ฌ์ฉํ์ง ์๋๋ค. ๊ตฌ์กฐ๋ก๋ DB๊ฐ ์์ผ๋ฉด ORM์ด ์กด์ฌํ๊ณ ์์ค์ฝ๋์์ newํ๊ณ ๊ฐ์ฒด ๋ง๋ค๊ณ ์ถ๊ฐ ๋ฉ์๋๋ง ๋ชจ๋ธ์ ์ง์ด ๋ฃ์ ์ํ์์ ์ค๊ฐ์ ์ฟผ๋ฆฌ๋ฌธ์ผ๋ก ๋ฐ๊พผ๋ค. ์ง๊ฐ ์์์ ํด์ํด์ ๊ฐ์ ธ๋ค๊ฐ ์ค๋ค. ์ฝ๋์์์๋ sql์ด ์๋ค์ด๊ฐ๋ค. ์ด๋ ๊ฒ ํ๋ฉด ์ฅ์ ์ด ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๋ฐ๊พธ๋ฉด ORM์ด ๋งก์ ๋ถ๋ถ๋ง ์ค์ ํ๋ฉด ๋๋ค. JPA java pasistence API .. ์ฌ์ฉ๋ฐฉ๋ฒ์ ์ฃผ์ฅ. JPA ๊ตฌํํ ๋ํ์ ์ธ๊ฒ Hibenate๊ฐ ์๋ค. ๋ง์ฐฌ๊ฐ์ง๋ก ์คํ๋ง์ spring - data - jpa ๊ฐ ์๋ค.
https://mvnrepository.com/artifact/org.mybatis/mybatis-spring/2.0.7
https://mvnrepository.com/artifact/org.mybatis/mybatis/3.5.10
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gyuone</groupId>
<artifactId>BoardProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.22</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
</project>
'IT > WEB' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[40์ผ์ฐจ] ๊ฒ์ํ ๋ง๋ค๊ธฐ(3) delete. update ์ถ๊ฐ ๐ ์ต์ข ๊ฒ์ํ ๋ง๋ค๊ธฐ (0) | 2022.08.17 |
---|---|
[39์ผ์ฐจ] ๊ฒ์ํ ๋ง๋ค๊ธฐ (2) (0) | 2022.08.16 |
[38์ผ์ฐจ] FirstSpring (0) | 2022.08.12 |
[38์ผ์ฐจ] AOP/ aop concert project (0) | 2022.08.12 |
[37์ผ์ฐจ] AutoDi (0) | 2022.08.11 |
๋๊ธ