diff --git a/src/site/es/xdoc/batch.xml b/src/site/es/xdoc/batch.xml
index e6f96bd54b..f5de8c226b 100644
--- a/src/site/es/xdoc/batch.xml
+++ b/src/site/es/xdoc/batch.xml
@@ -43,7 +43,7 @@
- Este bean es un
@@ -155,7 +155,7 @@ public Map
- Este bean es un
diff --git a/src/site/ja/xdoc/batch.xml b/src/site/ja/xdoc/batch.xml
index 4003c31337..28ee1b0461 100644
--- a/src/site/ja/xdoc/batch.xml
+++ b/src/site/ja/xdoc/batch.xml
@@ -142,7 +142,7 @@ public Map
- This bean is an
diff --git a/src/site/ko/xdoc/batch.xml b/src/site/ko/xdoc/batch.xml
index a23b4527de..b1c0414fc5 100644
--- a/src/site/ko/xdoc/batch.xml
+++ b/src/site/ko/xdoc/batch.xml
@@ -31,15 +31,16 @@
마이바티스 스프링 연동모듈의 1.1.0버전에서는 스프링 배치 애플리케이션을 만들기 위해 두개의 빈을 제공한다.
두개의 빈은 중요 이 문서는 스프링 배치에 대한 것으로
마이바티스 배치 SqlSession을 다루지는 않는다. 배치 세션에 대해서는 SqlSession 사용에서 좀더 다루었다. 이 빈은 마이바티스로 페이지를 처리하는 형태로 데이터베이스 데이터를 읽어오는 이 빈은 마이바티스로 페이지를 처리하는 형태로 데이터베이스 데이터를 읽어오는 요청된 데이터를 가져오기 위해
- This bean is an
- NOTE To use this bean you need at least MyBatis 3.4.0 or a newer version.
+ 중요 이 빈을 사용하려면 최소한 MyBatis 3.4.0 이나 그 이상이어야 한다.
- It executes the query specified as the
- The reader will use a separate connection so the select statement does no participate in any transactions created
- as part of the step processing.
+ reader 는 별도의 connection 을 사용하므로 select 문은 step processing 일부로 생성된 트랜잭션에 속하지 않는다.
When using the cursor you can just execute a regular query: cursor 를 사용할 때 다음과 같이 일반 쿼리를 실행할 수 있다. Follows below a sample configuration snippet: 아래는 샘플 설정이다.
- Please see the MyBatis Spring-boot-stater
- subproject docs for details.
+ 자세한 내용은 MyBatis Spring-boot-stater
+ 하위 프로젝트 문서를 참조하십시오.
마이바티스만 사용하면, 팩토리 빈을 생성하기 위해, 스프링 XML설정파일에 다음설정을 추가하자. 설정파일이 마이바티스 설정을 완전히 다룰 필요는 없다.
어떤 환경, 어떤 데이터소스 그리고 마이바티스 트랜잭션 관리자가 무시될수도 있다.
- 설정파일이 필요한 다른 이유는 마이바티스 XML파일이 매퍼 클래스와 동일한 클래스패스에 있지 않은 경우이다.
이 설정을 사용하면 두가지 옵션이 있다.
@@ -89,7 +89,7 @@ public SqlSessionFactory sqlSessionFactory() {
이에 관련해서는 트랜잭션을 다루는 장에서 볼수 있다.
- In case you are using the multi-db feature you will need to set the 이 장은 마이바티스 스프링 연동모듈을 설치하고 셋팅하는 방법에 대해 간단히 보여준다.
그리고 트랜잭션을 사용하는 간단한 애플리케이션을 만드는 방법까지 다룰 것이다. 마이바티스 스프링 연동모듈을 사용하기 위해서, 클래스패스에 메이븐을 사용하고 있다면 pom.xml에 다음처럼 의존성을 추가하면 된다. 마이바티스를 스프링과 함께 사용하려면 스프링의 애플리케이션 컨텍스트에 적어도 두개를 정의해줄 필요가 있다.
두가지는 IteamReader que lee registros de una base de datos usando paginación.
+ Este bean es un ItemReader que lee registros de una base de datos usando paginación.
IteamReader que lee registros de la base de datos usando un cursor.
+ Este bean es un ItemReader que lee registros de la base de datos usando un cursor.
IteamReader that reads records from a database using a cursor.
+ This bean is an ItemReader that reads records from a database using a cursor.
MyBatisPagingItemReader 와 MyBatisCursorItemReader 와 MyBatisBatchItemWriter이다.
- Also, As of version 2.0.0 provides three builder classes for supporting the Java Configuration: the MyBatisPagingItemReaderBuilder,
- the MyBatisCursorItemReaderBuilder and the MyBatisBatchItemWriterBuilder.
+
+ 또한 2.0.0 버전에서는 Java Configuration 을 지원하는 다음의 세 가지 Builder class 를 제공한다.
+ MyBatisPagingItemReaderBuilder, MyBatisCursorItemReaderBuilder 그리고 MyBatisBatchItemWriterBuilder 이다.
IteamReader이다. ItemReader이다. setQueryId 프로퍼티에 명시된 쿼리를 실행한다.
쿼리는 setPageSize 프로퍼티에 명시된 크기만큼 데이터를 가져오도록 실행된다.
@@ -140,31 +141,28 @@ public MapIteamReader that reads records from a database using a cursor.
+ 이 빈은 cursor 를 사용하여 데이터베이스에서 레코드를 읽는 ItemReader 이다.
setQueryId property to retrieve requested data
- by using the method selectCursor().
- Each time a read() method is called it will return the next element of the cursor until no more
- elements are left.
+ setQueryId 속성으로 지정된 쿼리를 실행하여 selectCursor() 메서드를 사용하여 요청 된 데이터를 검색한다.
+ read() 메서드가 호출 될 때마다 요소가 더 이상 남아 있지 않을 때까지 cursor 의 다음 요소를 반환한다.
SqlSessionFactory는 SqlSessionFactoryBuilder를 사용해서 생성한다.
마이바티스 스프링 연동모듈에서는, SqlSessionFactoryBean가 대신 사용된다. MapperFactoryBean나 SqlSessionDaoSupport를 확장하는 다른 DAO에 주입될것이다. SqlSessionFactory는 JDBC DataSource의 필수 프로퍼티가 필요하다.
어떤 DataSource라도 상관없고 다른 스프링 데이터베이스 연결처럼 설정되어야만 한다. SqlSessionFactoryBean creates its own, custom MyBatis Environment with these values set as required. SqlSessionFactoryBean 는 필요에 따라 이 값들을 설정하여 자체적인 MyBatis Environment 를 만든다. databaseIdProvider property:
+ 만약 multi-db 기능을 사용한다면 다음과 같이 databaseIdProvider 속성을 설정해야 한다.
configuration property has been added.
- It can be specified a Configuration instance directly without MyBatis XML configuration file.
- For example:
+ 1.3.0 버전 부터 configuration 속성이 추가되었다.
+ 다음과 같이 MyBatis XML 설정 파일없이 Configuration 인스턴스를 직접 지정할 수 있습니다.
mybatis-spring-${project.version}.jar를 포함시켜야 한다. SqlSessionFactory와 한개 이상의 매퍼 인터페이스이다. DataAccessException예외가 발생한다.
- If you use the Java Configuration: + 자바로 설정하면 다음과 같다.
마이바티스 스프링 연동모듈은 마이바티스와 스프링을 편하고 간단하게 연동한다.
이 모듈은 마이바티스로 하여금 스프링 트랜잭션에 쉽게 연동되도록 처리한다.
게다가 마이바티스 매퍼와 SqlSession을 다루고 다른 빈에 주입시켜준다.
마이바티스 예외를 스프링의 DataAccessException로 변환하기도 하고 마이바티스, 스프링 또는 마이바티스 스프링 연동모듈에 의존성을 없애기도 한다.
스프링 2.x은 아이바티스 2.x만을 지원한다. 스프링 3.x에서 마이바티스 3.x를 지원하기 위한 시도가 진행중이다. (스프링의 이슈관리 시스템인 이슈 를 보라.) @@ -46,7 +46,7 @@ 마이바티스 커뮤니티는 재결합하는 형태로 결정을 내고 대신 마이바티스의 하위 프로젝트 형태로 스프링 연동 프로젝트를 추가한다.
마이바티스 스프링 연동을 시작하기 전에, 마이바티스와 스프링의 용어를 맞추는 일이 굉장히 중요했다. 이 문서는 배경지식이나 기본적인 셋업방법 그리고 마이바티스와 스프링의 설정에 대한 튜토리얼등은 제공하지 않는다.
@@ -111,7 +111,7 @@
이 프로젝트가 실제로 만들어지게 도와준 모든 특별한 분들에게 정말 감사한다. 알파벳 순서로 보면, 코딩및 테스트 그리고 문서화를 담당했던 Eduardo Macarron, Hunter Presnall, Putthiphong Boonphong; 그외 다양한 프로젝트 기여자인 Andrius Juozapaitis, Giovanni Cuccu, Mike Lanyon, Raj Nagappan, Tomas Pinos; @@ -119,17 +119,17 @@ 이들이 없었다면 이 프로젝트는 존재하지 않았을 것이다.
만약에 어떤 방법으로든 이 문서의 취약점이 발견되거나 기능에 대한 문서화가 빠진 부분이 보인다면, 가장 좋은 방법은 먼저 공부해서 자신만의 문서를 작성하는 것이다.
이 문서의 원본은 xdoc포맷이며 프로젝트의 Git에서 찾을 수 있다. - 저장소를 포크입니다, 를 업데이트합니다, 그리고 풀 요청을 보냅니다. + repository 를 fork 하고, 업데이트하고 pull request 를 보내주십시오.
당신처럼 이 문서를 읽는 사람들에게 이 문서의 최고의 저자가 될수 있다!
사용자들은 다음의 번역문서별로 마이바티스 스프링 연동모듈에 대해 알수 있다.
위 번역문서에는 없지만 자국의 언어로 문서로 보고 싶다면, 자국의 언어로 된 문서를 만들어서 우리에게 보내달라.
번역자 : 이동국(fromm0@gmail.com, http://ldg.pe.kr, https://www.facebook.com/dongguk.lee.3)
데이터 접근 객체인 DAO를 만든것보다 직접 SqlSessionDaoSupport 나 SqlSessionTemplate 를 사용하자.
마이바티스 스프링 연동모듈은 다른 빈에 직접 주입할 수 있는 쓰레드에 안전한 매퍼를 생성할 수 있다.
매퍼를 등록하는 방법은 기존의 전통적인 XML설정법을 사용하거나 새로운 3.0 이후의 자바설정(일명 @Configuration)을 사용하느냐에 따라 다르다.
SqlSessionTemplate 를 사용해야만 한다.
하나씩 매퍼를 모두 등록할 필요가 없다. 대신 클래스패스를 지정해서 마이바티스 스프링 연동모듈의 자동스캔기능을 사용할 수 있다.
diff --git a/src/site/ko/xdoc/sample.xml b/src/site/ko/xdoc/sample.xml index 11b5b2ad1c..aa1e476e03 100644 --- a/src/site/ko/xdoc/sample.xml +++ b/src/site/ko/xdoc/sample.xml @@ -25,24 +25,24 @@ -- NOTE - See JPetstore 6 demo to know about how to use Spring with a full web application server. + 중요 + 전체 웹 애플리케이션 서버에서 Spring을 사용하는 방법을 알고 싶다면 JPetstore 6 demo 를 참조하십시오.
- You can check out sample code from the MyBatis-Spring repo: + MyBatis-Spring repository 에서 샘플 코드를 확인할 수 있다.
- Any of the samples can be run with JUnit 5. + 모든 샘플은 JUnit5 에서 실행할 수 있다.
- The sample code shows a typical design where a transactional service gets domain objects from a data access layer. + 샘플 코드는 트랜잭션 서비스가 data access layer 에서 도메인 개체를 가져 오는 일반적인 디자인을 보여준다.
- FooService.java acts as the service:
+ 다음 FooService.java 는 서비스처럼 작동한다.
- It is a transactional bean, so a transaction is started when any of its methods is called
- and committed when the method ends without throwing an unchecked exception.
- Notice that transactional behaviour is configured with the
- @Transactional
- attribute. This is not required; any other way provided by Spring can be used to demarcate
- your transactions.
+ 이것은 트랜잭션 빈이다. 따라서 어떤 메서드든 실행이 되면 트랜잭션이 시작되고 예외가 발생하지 않았을 때 커밋된다.
+ 트랜잭션은 @Transactional annotation 을 통해 설정할 수 있다.
+ 이것은 필수가 아니다. Spring이 제공하는 다른 방법을 사용하여 트랜잭션을 구분할 수 있다.
- This service calls a data access layer built with MyBatis. This layer
- consists on a just an interface UserMapper.java
- that will be used with a dynamic proxy built by MyBatis at
- runtime and injected into the service by Spring.
+ 이 서비스는 MyBatis로 이루어진 DAO layer 를 호출한다.
+ 이 layer는 런타임시 MyBatis에 의해 작성되고 Spring에 의해 서비스에 주입되는 동적 프록시와 함께 사용되는 UserMapper.java 인터페이스로 구성된다.
- Note that, for the sake of simplicity we used the interface UserMapper.java for the DAO scenario
- where a DAO is built with an interface and a implementation though in this case it would have been more
- adequate to use an interface called UserDao.java instead.
+ 단순함을 위해서 DAO가 인터페이스와 그 구현체로 만들어진 DAO 시나리오를 위해 UserMapper.java 인터페이스를 사용했지만,
+ 이 경우 대신 UserDao.java라는 인터페이스를 사용하는 것이 더 적절하다.
- We will see different ways to find the mapper interface, register it to Spring and inject it into the service bean: + 매퍼 인터페이스를 찾고 Spring에 등록하고 서비스 빈에 주입하는 여러 가지 방법을 살펴본다.
| Sample test | -Description | +샘플 테스트 | +설명 |
- Shows you the base configuration based on a MapperFactoryBean
- that will dynamically build an implementation for UserMapper
+ UserMapper 구현체를 동적으로 빌드 할 MapperFactoryBean에 기반한 기본 구성을 보여준다.
|
|---|---|---|---|
- Shows how to use the MapperScannerConfigurer so all the mappers in a project are autodiscovered.
+ MapperScannerConfigurer 를 사용하여 어떻게 프로젝트의 모든 매퍼들을 자동으로 검색되도록 하는 방법을 보여준다.
|
|||
- Shows how to hand code a DAO using a Spring managed SqlSession
- and providing your own implementation UserDaoImpl.java.
+ Spring에서 관리하는 SqlSession을 사용하여 DAO를 코딩하고 자체적인 구현체인 UserDaoImpl.java 를 제공하는 방법을 보여준다.
|
|||
- Shows how to use Spring's @Configuration with the @MapperScann annotation so
- mappers are autodiscovered.
+ 스프링의 @Configuration과 @MapperScann annotation을 함께 사용하여 매퍼를 자동으로 검색하는 방법을 보여준다.
|
|||
| - Shows how to use the custom MyBatis XML namespace. + 커스텀 MyBatis XML 네임스페이스를 사용하는 방법을 보여준다. | |||
- Shows how to use Spring's @Configuration to create MyBatis beans manually.
+ 스프링의 @Configuration을 사용하여 MyBatis 빈들을 수동적으로 생성하는 방법을 보여준다.
|
|||
- Shows how to use ItemReader and ItemWriter on Spring Batch using Java Configuration.
+ Java Configuration을 이용하여 Spring Batch에서 어떻게 ItemReader과 ItemWriter를 사용하는지 보여준다.
|
|||
- Shows how to use ItemReader and ItemWriter on Spring Batch using XML Configuration.
+ XML Configuration을 이용하여 Spring Batch에서 어떻게 ItemReader과 ItemWriter를 사용하는지 보여준다.
|
- Please take a look at the different applicationContext.xml files to see MyBatis-Spring in action.
+ MyBatis-Spring이 실제로 어떻게 다르게 작동하는지 보려면 applicationContext.xml 파일을 살펴보십시오.
마이바티스에서는 SqlSession를 생성하기 위해 SqlSessionFactory를 사용한다.
세션을 한번 생성하면 매핑구문을 실행하거나 커밋 또는 롤백을 하기 위해 세션을 사용할수 있다.
마지막으로 더 이상 필요하지 않은 상태가 되면 세션을 닫는다.
diff --git a/src/site/ko/xdoc/transactions.xml b/src/site/ko/xdoc/transactions.xml
index ecbd832d85..ca797244ef 100644
--- a/src/site/ko/xdoc/transactions.xml
+++ b/src/site/ko/xdoc/transactions.xml
@@ -38,7 +38,7 @@
마이바티스 스프링 연동모듈은 한번 셋업되면 트랜잭션을 투명하게 관리한다. DAO클래스에 어떠한 추가적인 코드를 넣을 필요가 없다.
-스프링 트랜잭션을 가능하게 하려면, 스프링 설정파일에 DataSourceTransactionManager를 생성하자.
이 코드는 매퍼를 사용하지만 SqlSession를 사용해서 잘 동작할 것이다.
이 코드는 매퍼를 사용하지만 SqlSession를 사용해도 잘 동작한다.
마이바티스 스프링 연동모듈을 사용해더라도 마이바티스 API를 직접 사용할 수 있다.
- SqlSessionFactoryBean을 사용해서 스프링에서 SqlSessionFactory를 생성하고 팩토리를 사용하자.
MyBatis-Spring 연동 모듈을 사용해도 계속해서 MyBatis API를 직접 사용할 수 있다.
+ SqlSessionFactoryBean을 사용해서 스프링에서 SqlSessionFactory를 생성하고 팩토리를 사용하면 된다.
이 방법은 신중히 사용하자. 왜냐하면 잘못사용하면 런타임 에러나 데이터 문제등을 야기할수 있기 때문이다. +
이 방법은 신중히 사용하자. 왜냐하면 잘못사용하면 런타임 에러나 데이터 문제등을 야기할수 있기 때문이다. API를 직접 사용할때는 다음의 규칙들에 유의해야 한다.
스프링 트랜잭션에 속할지 않고 별도의 트랜잭션에서 동작한다.
+스프링 트랜잭션에 속하지 않고 별도의 트랜잭션에서 동작한다.
SqlSession이 스프링 트랜잭션 관리자가 사용하는 DataSource를 사용하고
- 이미 트랜잭션이 동작하고 있다면 이 코드는 예외를 발생시킬것이다.
마이바티스의 DefaultSqlSession은 쓰레드에 안전하지 않다.
- 빈에 이 객체를 주입하면 아마도 에러를 발생시킬수있다.
DefaultSqlSession을 사용해서 생성한 매퍼 또한 쓰레드에 안전하지 않다.
- 이렇게 만든 매퍼를 빈에 주입하면 에러를 발생시킬수있다.
SqlSession은 항상 마지막에 닫아주는 것을 확인해야 한다.
SqlSession은 항상 마지막에 close() 메서드를 호출해야 한다.