mybatis
-
SqlSessionFactory 클래스 정리JAVA/ORM 2024. 7. 29. 19:22
▤ 목차" data-ke-type="html">HTML 삽입미리보기할 수 없는 소스 MyBatis를 배우는데 자연스럽게 사용하지만 궁금한 인터페이스가 있었다.SqlSessionFactory는 MyBatis 프레임워크에서 중요한 인터페이스 중 하나이다.이 인터페이스는 데이터베이스와의 연결을 설정하고 SQL 세션을 생성하는 역할을 한다.이름에서 알 수 있는 점은, Factory 패턴이 사용되었다는 점이다. ✔ SqlSessionFactory 인터페이스 정의SqlSessionFactory는 MyBatis에서 DB와의 연결을 설정하고 SQL 세션을 생성하는 인터페이스이다.MyBatis는 데이터베이스 접근 계층을 제공한다.개발자는 SQL 매퍼 파일을 통해 SQL 쿼리와 자바 객체 간의 매핑을 할 수 있다. ⌨..
-
[JSP] MyBatis 적용 (ORM/ 어노테이션 없이)JAVA/ORM 2024. 7. 29. 01:08
HTML 삽입미리보기할 수 없는 소스 ✔ ORM (Object Relation Mapping)✏️ 개념ORM이란 객체와 DB의 테이블을 Mapping 시켜 RDB 테이블을 객체지향적으로 사용할 수 있게 해주는 기술이다.관계형 데이터베이스 시스템 (MySQL, PostgreSQL..)은 테이블과 열로 구성된 데이터를 사용한다. 데이터는 객체이며 독립된 데이터와 독립된 함수를 지닌다. 객체지향 프로그래밍 언어( JAVA .. )는 클래스와 객체로 데이터를 구성한다. RDB 테이블은 객체지향적 특성(상속, 다형성 .. )* 등이 없어서 JAVA와 같은 객체지향적 언어로 접근하는 것이 쉽지 않다. 이러한 (객체 모델과 관계형 모델 간의) 불일치를 해결하기 위해서 ORM을 사용하면 보다 객체지향적으로 RDB를 사..