소개
게시글
질문&답변
Movie em.find JOIN 실행시 오류 발생
해결 했습니다:) 에러 메세지 중 다음과 같은 문구를 발견해서 관련 문구로 질문 서치 후 다음 질문 답변을 발견했습니다WARN: GenerationTarget encountered exception accepting command : Error executing DDLhttps://www.inflearn.com/questions/808355/error-executing-ddl나와 있는 대로 단순 데베 오류인 것 같아서 table 전체 drop 후 재실행 하니 정상 작동 되었습니다:) 혹시 저와 같은 오류를 겪는 분이 있으실까 싶어 답변 남겨둡니다.(사진)(사진)
- 1
- 2
- 413
질문&답변
table 생성 관련
쿼리 메세지 입니다. drop table OrderItem if existsHibernate: drop table OrderItem if exists11:55:39.873 [main] DEBUG org.hibernate.SQL - drop sequence if exists hibernate_sequenceHibernate: drop sequence if exists hibernate_sequence11:55:39.879 [main] DEBUG org.hibernate.SQL - create sequence hibernate_sequence start with 1 increment by 1Hibernate: create sequence hibernate_sequence start with 1 increment by 111:55:39.879 [main] INFO org.hibernate.orm.connections.access - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@508a65bf] 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.11:55:39.881 [main] DEBUG org.hibernate.SQL - create table Member ( id bigint not null, city varchar(255), name varchar(255), street varchar(255), zipcode varchar(255), primary key (id) )Hibernate: create table Member ( id bigint not null, city varchar(255), name varchar(255), street varchar(255), zipcode varchar(255), primary key (id) )11:55:39.883 [main] DEBUG org.hibernate.type.EnumType - Using NAMED-based conversion for Enum jpabook.jpashop.domain.OrderStatus11:55:39.884 [main] DEBUG org.hibernate.SQL - create table Order ( ORDER_ID bigint not null, MEMBER_ID bigint, orderDate timestamp, status varchar(255), primary key (ORDER_ID) )Hibernate: create table Order ( ORDER_ID bigint not null, MEMBER_ID bigint, orderDate timestamp, status varchar(255), primary key (ORDER_ID) )11:55:39.885 [main] WARN org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL " create table Order ( ORDER_ID bigint not null, MEMBER_ID bigint, orderDate timestamp, status varchar(255), primary key (ORDER_ID) )" via JDBC Statementorg.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL " create table Order ( ORDER_ID bigint not null, MEMBER_ID bigint, orderDate timestamp, status varchar(255), primary key (ORDER_ID) )" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135) at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:310) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at jpabook.jpashop.JpaMain.main(JpaMain.java:13)Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement " CREATE TABLE ORDER[*] ( ORDER_ID BIGINT NOT NULL, MEMBER_ID BIGINT, ORDERDATE TIMESTAMP, STATUS VARCHAR(255), PRIMARY KEY (ORDER_ID) ) "; expected "identifier"; SQL statement: create table Order ( ORDER_ID bigint not null, MEMBER_ID bigint, orderDate timestamp, status varchar(255), primary key (ORDER_ID) ) [42001-199] at org.h2.message.DbException.getJdbcSQLException(DbException.java:451) at org.h2.engine.SessionRemote.done(SessionRemote.java:607) at org.h2.command.CommandRemote.prepare(CommandRemote.java:85) at org.h2.command.CommandRemote.(CommandRemote.java:51) at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:477) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1292) at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:217) at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:205) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ... 15 common frames omitted11:55:39.885 [main] DEBUG org.hibernate.SQL - create table OrderItem ( ORDER_ITEM_ID bigint not null, count integer not null, ITEM_ID bigint, ORDER_ID bigint, orderPrice integer not null, primary key (ORDER_ITEM_ID) )Hibernate: create table OrderItem ( ORDER_ITEM_ID bigint not null, count integer not null, ITEM_ID bigint, ORDER_ID bigint, orderPrice integer not null, primary key (ORDER_ITEM_ID) )
- 0
- 6
- 795
질문&답변
table 생성 관련
orderitem 코드입니다. package jpabook.jpashop.domain;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.Id;@Entitypublic class OrderItem { @Id @GeneratedValue @Column(name = "ORDER_ITEM_ID") private Long id; @Column(name = "ORDER_ID") private Long orderId; @Column(name = "ITEM_ID") private Long itemId; private int orderPrice; private int count; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getOrderId() { return orderId; } public void setOrderId(Long orderId) { this.orderId = orderId; } public Long getItemId() { return itemId; } public void setItemId(Long itemId) { this.itemId = itemId; } public int getOrderPrice() { return orderPrice; } public void setOrderPrice(int orderPrice) { this.orderPrice = orderPrice; } public int getCount() { return count; } public void setCount(int count) { this.count = count; }}
- 0
- 6
- 795
질문&답변
table 생성 관련
order file 코드 입니다. package jpabook.jpashop.domain;import javax.persistence.*;import java.time.LocalDateTime;@Entitypublic class Order { @Id @GeneratedValue @Column(name = "ORDER_ID") //이렇게 각자 컬럼을 생성해준다. private Long id; @Column(name = "MEMBER_ID") private Long memberId; private LocalDateTime orderDate; @Enumerated(EnumType.STRING) //ordinal 보다는 string이 좋음 private OrderStatus status; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getMemberId() { return memberId; } public void setMemberId(Long memberId) { this.memberId = memberId; } public LocalDateTime getOrderDate() { return orderDate; } public void setOrderDate(LocalDateTime orderDate) { this.orderDate = orderDate; } public OrderStatus getStatus() { return status; } public void setStatus(OrderStatus status) { this.status = status; }}
- 0
- 6
- 795
질문&답변
table 생성 관련
member file 코드입니다. import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;@Entitypublic class Member { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; private String city; private String street; private String zipcode; public Long getId() { return id; } public String getName() { return name; } public String getCity() { return city; } public String getStreet() { return street; } public String getZipcode() { return zipcode; } public void setId(Long id) { this.id = id; } public void setName(String name) { this.name = name; } public void setCity(String city) { this.city = city; } public void setStreet(String street) { this.street = street; } public void setZipcode(String zipcode) { this.zipcode = zipcode; }}
- 0
- 6
- 795
질문&답변
table 생성 관련
item file 코드 입니다. package jpabook.jpashop.domain;import javax.persistence.Column;import javax.persistence.GeneratedValue;import javax.persistence.Id;public class Item { @Id @GeneratedValue @Column(name = "ITEM_ID") private Long id; private String name; private int price; private int stockQuantity; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getStockQuantity() { return stockQuantity; } public void setStockQuantity(int stockQuantity) { this.stockQuantity = stockQuantity; }}
- 0
- 6
- 795
질문&답변
roletype값 관련 질문
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175) at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:173) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at hellojpa.JpaMain.main(JpaMain.java:10) Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:48) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:131) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:42) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:62) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:457) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.(DriverManagerConnectionProviderImpl.java:323) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.(DriverManagerConnectionProviderImpl.java:297) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:501) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:101) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:76) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:146) at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66) at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ... 14 more Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Connection is broken: "java.net.SocketTimeoutException: connect timed out: localhost" [90067-214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:678) at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) at org.h2.message.DbException.get(DbException.java:212) at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:437) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:325) at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:122) at org.h2.Driver.connect(Driver.java:59) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:39) ... 29 more Caused by: java.net.SocketTimeoutException: connect timed out at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:608) at org.h2.util.NetUtils.createSocket(NetUtils.java:135) at org.h2.util.NetUtils.createSocket(NetUtils.java:99) at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:130) at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:433) ... 33 more이렇게 에러 메세지가 뜹니다!!
- 0
- 2
- 583
질문&답변
hibernate관련 문제
build에 입력은 했는데 의존성 처리를 제대로 하지 않아서 그런거였습니다! 해결 했습니다. 감사합니다!:)
- 0
- 2
- 281