미해결
자바 ORM 표준 JPA 프로그래밍 - 기본편
h2 테이블 생성이 안됩니다.
package hellojpa;
import jakarta.persistence.*;
import java.util.Date;
@Entity
public class Member {
@Id
private Long id;
@Column(name = "name")
private String username;
private Integer age;
@Enumerated(EnumType.STRING)
private RoleType roleType;
@Temporal(TemporalType.TIMESTAMP)
private Date createdDate;
@Temporal(TemporalType.TIMESTAMP)
private Date lastModifiedDate;
@Lob
private String description;
public Member(){
}
}강사님과 똑같이 작성을 하고 실행하면 아무 쿼리도 나가지 않습니다."C:\Program Files\Java\jdk-17\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.1.2\lib\idea_rt.jar=49205:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.1.2\bin" -Dfile.encoding=UTF-8 -classpath "E:\Spring\자바 ORM 표준 JPA 프로그래밍 - 기본편\ex1-hello-jpa-start\ex1-hello-jpa\target\classes;C:\Users\LGE\.m2\repository\org\hibernate\orm\hibernate-core\6.4.2.Final\hibernate-core-6.4.2.Final.jar;C:\Users\LGE\.m2\repository\jakarta\persistence\jakarta.persistence-api\3.1.0\jakarta.persistence-api-3.1.0.jar;C:\Users\LGE\.m2\repository\jakarta\transaction\jakarta.transaction-api\2.0.1\jakarta.transaction-api-2.0.1.jar;C:\Users\LGE\.m2\repository\org\jboss\logging\jboss-logging\3.5.0.Final\jboss-logging-3.5.0.Final.jar;C:\Users\LGE\.m2\repository\org\hibernate\common\hibernate-commons-annotations\6.0.6.Final\hibernate-commons-annotations-6.0.6.Final.jar;C:\Users\LGE\.m2\repository\io\smallrye\jandex\3.1.2\jandex-3.1.2.jar;C:\Users\LGE\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\LGE\.m2\repository\net\bytebuddy\byte-buddy\1.14.7\byte-buddy-1.14.7.jar;C:\Users\LGE\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\4.0.0\jakarta.xml.bind-api-4.0.0.jar;C:\Users\LGE\.m2\repository\jakarta\activation\jakarta.activation-api\2.1.0\jakarta.activation-api-2.1.0.jar;C:\Users\LGE\.m2\repository\org\glassfish\jaxb\jaxb-runtime\4.0.2\jaxb-runtime-4.0.2.jar;C:\Users\LGE\.m2\repository\org\glassfish\jaxb\jaxb-core\4.0.2\jaxb-core-4.0.2.jar;C:\Users\LGE\.m2\repository\org\eclipse\angus\angus-activation\2.0.0\angus-activation-2.0.0.jar;C:\Users\LGE\.m2\repository\org\glassfish\jaxb\txw2\4.0.2\txw2-4.0.2.jar;C:\Users\LGE\.m2\repository\com\sun\istack\istack-commons-runtime\4.1.1\istack-commons-runtime-4.1.1.jar;C:\Users\LGE\.m2\repository\jakarta\inject\jakarta.inject-api\2.0.1\jakarta.inject-api-2.0.1.jar;C:\Users\LGE\.m2\repository\org\antlr\antlr4-runtime\4.13.0\antlr4-runtime-4.13.0.jar;C:\Users\LGE\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;C:\Users\LGE\.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;C:\Users\LGE\.m2\repository\com\h2database\h2\2.2.224\h2-2.2.224.jar" hellojpa.JpaMain6월 13, 2024 7:44:16 오전 org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformationINFO: HHH000204: Processing PersistenceUnitInfo [name: hello]6월 13, 2024 7:44:16 오전 org.hibernate.Version logVersionINFO: HHH000412: Hibernate ORM core version 6.4.2.Final6월 13, 2024 7:44:16 오전 org.hibernate.cache.internal.RegionFactoryInitiator initiateServiceINFO: HHH000026: Second-level cache disabled6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureWARN: HHH10001002: Using built-in connection pool (not intended for production use)6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001005: Loaded JDBC driver class: org.h2.Driver6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001012: Connecting with JDBC URL [jdbc:h2:tcp://localhost/~/test]6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001001: Connection properties: {password=****, user=sa}6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH10001003: Autocommit mode: false6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>INFO: HHH10001115: Connection pool size: 20 (min=1)6월 13, 2024 7:44:16 오전 org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl constructDialectWARN: HHH90000025: H2Dialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)6월 13, 2024 7:44:17 오전 org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateServiceINFO: HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)6월 13, 2024 7:44:17 오전 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stopINFO: HHH10001008: Cleaning up connection pool [jdbc:h2:tcp://localhost/~/test]Process finished with exit code 0<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hello">
<properties>
<!-- 필수 속성 -->
<property name="jakarta.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="jakarta.persistence.jdbc.user" value="sa"/>
<property name="jakarta.persistence.jdbc.password" value=""/>
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<!-- 옵션 -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.jdbc.batch_size" value="10"/>
<property name="hibernate.hdm2ddl.auto" value="create"/>
</properties>
</persistence-unit>
</persistence>
<property name="hibernate.hdm2ddl.auto" value="create"/>
위 코드로 인해 테이블이 계속 드랍이 되어 그전까지는 주석처리하여 쿼리가 나가고 테이블이 생성되었지만 현재 위 코드를 다시 주석처리 하든 하지 않든 쿼리가 나가지 않고 테이블 생성이 되지 않습니다