해결된 질문
작성
·
1.2K
0
답변 2
1
저도 같은 문제 있었는데 다음과 같이 migration 하니 되네요 참고하시길.
MyH2Dialect.class
public class MyH2Dialect extends H2Dialect {
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
functionContributions
.getFunctionRegistry()
.register("group_concat",
new StandardSQLFunction("group_concat", StandardBasicTypes.STRING));
}
}
근데 이외에도 Member에 @Id @GeneratedValue(strategy = GenerationType.IDENTITY)로 고치고, persistence.xml을 다음과 같이 고쳐야 됩니다.
Member.class
@Entity
@Getter
@Setter
public class Member {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// 이하 생략
}
persistence.xml
<property name="hibernate.dialect" value="hellojpa.dialect.MyH2Dialect"/>
또한 pom.xml에 hibernate-entitymanager dependency를 5.6.15.Final 버전 추가해줬습니다.
h2 버전은 2.2.220 사용했습니다.
1
안녕하세요. Sunghyuk Lee님, 공식 서포터즈 OMG입니다.
메이저버전이 바뀔 때 큰 변화가 있는 편인데 JPQL 이랑 H2에서 변화가 있었나 보네요.
강의 수강은 5.x로 진행해주세요.
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jpa-basic</groupId>
<artifactId>ex1-hello-jpa</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>
8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <!-- JPA 하이버네이트 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.29.Final</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency> <!-- H2 데이터베이스 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency> <!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>
</project>
실무에서는 안정화된 release 버전을 사용합니다.
알파 버전은 개발 초기에 있어 성능이나 사용성 등을 평가하기 위한 테스터나 개발자를 위한 버전입니다.
감사합니다.
감사합니다. ^^