온 코딩

ERROR: ORA-02289: sequence does not exist Client클래스 ERR org.hibernate.exception.SQLGrammarException: could not extract ResultSet 본문

복습 ARCHIVE/오류

ERROR: ORA-02289: sequence does not exist Client클래스 ERR org.hibernate.exception.SQLGrammarException: could not extract ResultSet

SummerON 2021. 7. 5. 13:25

7월 05, 2021 12:03:08 오후 org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: JPAProject
...]
7월 05, 2021 12:03:09 오후 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
7월 05, 2021 12:03:09 오후 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
7월 05, 2021 12:03:09 오후 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
7월 05, 2021 12:03:09 오후 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
7월 05, 2021 12:03:09 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
7월 05, 2021 12:03:10 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@127.0.0.1:1521:XE]
7월 05, 2021 12:03:10 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=hhw, password=****}
7월 05, 2021 12:03:10 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
7월 05, 2021 12:03:10 오후 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
7월 05, 2021 12:03:14 오후 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
7월 05, 2021 12:03:14 오후 org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [byte[]] overrides previous : org.hibernate.type.BinaryType@6a57ae10
7월 05, 2021 12:03:14 오후 org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [[B] overrides previous : org.hibernate.type.BinaryType@6a57ae10
7월 05, 2021 12:03:14 오후 org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [Byte[]] overrides previous : org.hibernate.type.WrapperBinaryType@28b46423
7월 05, 2021 12:03:14 오후 org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [[Ljava.lang.Byte;] overrides previous : org.hibernate.type.WrapperBinaryType@28b46423
7월 05, 2021 12:03:15 오후 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 2289, SQLState: 42000
7월 05, 2021 12:03:15 오후 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: ORA-02289: sequence does not exist

Client ERR  org.hibernate.exception.SQLGrammarException: could not extract ResultSet
7월 05, 2021 12:03:15 오후 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:oracle:thin:@127.0.0.1:1521:XE]

 

원인 

hibernate 사용 시, 설정을 

<property name="hibernate.id.new_generator_mappings" value="true"/>

이라고 했는데, 해당 시퀀스가 없을 경우 오류 발생 

 

해결 방법 

시퀀스를 만들어 사용하게끔 어노테이션 수정

@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ")
@SequenceGenerator(name = "SEQ", sequenceName = "BOARD_SEQ")
private int seq;

 

persistence.xml 파일에서 

<property name="hibernate.id.new_generator_mappings" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />

속성을 통해 해결도 가능 

Comments