인프런 커뮤니티 질문&답변

latellbin님의 프로필 이미지
latellbin

작성한 질문수

자바 ORM 표준 JPA 프로그래밍 - 기본편

실전 예제 1 - 요구사항 분석과 기본 매핑

Unable to build Hibernate SessionFactory오류

작성

·

2.4K

0

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.

1. 강의 내용과 관련된 질문을 남겨주세요.
2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.
(자주 하는 질문 링크: https://bit.ly/3fX6ygx)
3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.
(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)

질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.
=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)

[질문 내용]

10월 16, 2023 11:17:27 오후 org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation

INFO: HHH000204: Processing PersistenceUnitInfo [name: hello]

10월 16, 2023 11:17:27 오후 org.hibernate.Version logVersion

INFO: HHH000412: Hibernate ORM core version 6.3.0.Final

10월 16, 2023 11:17:27 오후 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl lambda$normalizeConnectionAccessUserAndPass$6

WARN: HHH90000021: Encountered deprecated setting [javax.persistence.jdbc.user], use [jakarta.persistence.jdbc.user] instead

10월 16, 2023 11:17:27 오후 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl lambda$normalizeConnectionAccessUserAndPass$12

WARN: HHH90000021: Encountered deprecated setting [javax.persistence.jdbc.password], use [jakarta.persistence.jdbc.password] instead

10월 16, 2023 11:17:27 오후 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl normalizeDataAccess

WARN: HHH90000021: Encountered deprecated setting [javax.persistence.jdbc.url], use [jakarta.persistence.jdbc.url] instead

10월 16, 2023 11:17:27 오후 org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl normalizeDataAccess

WARN: HHH90000021: Encountered deprecated setting [javax.persistence.jdbc.driver], use [jakarta.persistence.jdbc.driver] instead

10월 16, 2023 11:17:27 오후 org.hibernate.cache.internal.RegionFactoryInitiator initiateService

INFO: HHH000026: Second-level cache disabled

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH10001002: Using built-in connection pool (not intended for production use)

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001005: Loaded JDBC driver class: org.h2.Driver

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001012: Connecting with JDBC URL [jdbc:h2:tcp://localhost/~/jpashop]

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001001: Connection properties: {password=****, user=sa}

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001003: Autocommit mode: false

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>

INFO: HHH10001115: Connection pool size: 20 (min=1)

10월 16, 2023 11:17:27 오후 org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl constructDialect

WARN: HHH90000025: H2Dialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)

10월 16, 2023 11:17:29 오후 org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService

INFO: HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)

10월 16, 2023 11:17:29 오후 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection

INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@5dc769f9] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.

10월 16, 2023 11:17:29 오후 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

WARN: SQL Error: 42122, SQLState: 42S22

10월 16, 2023 11:17:29 오후 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

ERROR: Column "start_value" not found [42122-214]

10월 16, 2023 11:17:29 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stop

INFO: HHH10001008: Cleaning up connection pool [jdbc:h2:tcp://localhost/~/jpashop]

Exception in thread "main" jakarta.persistence.PersistenceException: [PersistenceUnit: hello] Unable to build Hibernate SessionFactory

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1563)

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1484)

at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:55)

at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)

at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)

at jpashose.jpashop.JpaMain.main(JpaMain.java:12)

Caused by: org.hibernate.exception.SQLGrammarException: Unable to build DatabaseInformation [Column "start_value" not found [42122-214]] [n/a]

at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:66)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:58)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:108)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:94)

at org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:194)

at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:98)

at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:286)

at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:145)

at java.base/java.util.HashMap.forEach(HashMap.java:1337)

at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:142)

at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37)

at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)

at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)

at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450)

at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1479)

... 4 more

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "start_value" not found [42122-214]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)

at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)

at org.h2.message.DbException.get(DbException.java:223)

at org.h2.message.DbException.get(DbException.java:199)

at org.h2.jdbc.JdbcResultSet.getColumnIndex(JdbcResultSet.java:3492)

at org.h2.jdbc.JdbcResultSet.getLong(JdbcResultSet.java:745)

at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.resultSetStartValueSize(SequenceInformationExtractorLegacyImpl.java:110)

at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.lambda$extractMetadata$0(SequenceInformationExtractorLegacyImpl.java:54)

at org.hibernate.tool.schema.extract.spi.ExtractionContext.getQueryResults(ExtractionContext.java:50)

at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:39)

at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:66)

at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:60)

at org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:185)

... 14 more

h2설정후 main돌려보면 자꾸 이런식으로 뜹니다

재설치도 많이해봤고 강의와 같은버젼으로 돌렸는데도 오류가 발생하는데왜이러죠 >??

 



public class JpaMain {
public static void main(String[] args) {

EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
try {
tx.commit();
} catch (Exception e) {
tx.rollback();
}finally {
em.close();
}
emf.close();
}
}
이건 main코드입니다

답변 1

0

안녕하세요. latellbin님, 공식 서포터즈 y2gcoder입니다.

다음 링크(클릭)을 보시고 차근차근 해결해보시겠습니까?

보통은 datasource url 의 MVCC=TRUE를 지우거나, h2 DB 버전을 pom.xml과 맞추는 방법으로 많이 해결했던 것 같습니다!

감사합니다.

latellbin님의 프로필 이미지
latellbin
질문자

강의와 동일하지않은 h2버젼을 사용해도 상관이없다는말씀이신가요?

네. 1.4.200 버전은 큰 문제가 없었던 것으로 기억합니다 :)

latellbin님의 프로필 이미지
latellbin

작성한 질문수

질문하기