๋ถ๋ชจ/์์ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๋ HR ์ ํ๊ตฐ์๋ ๋ง์ ํ
์คํธ๊ฐ ์์ต๋๋ค. ์: EagerTest
.
MS SQL์ ์ฌ์ฉํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ํ ์คํธ๊ฐ ์คํจํฉ๋๋ค.
javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
๋๋ ์ด๊ฒ์ด ์ด ์ ์ ๋๋ฌธ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
[Hibernate] create table Node (id int not null, string varchar(255), version int, parent_id int, primary key (id))
์๋ง๋ NULL
๋ก ๋ช
์์ ์ผ๋ก ์ ์ธ๋์ด์ผ ํฉ๋๋ค.
์๋ง๋
NULL
๋ก ๋ช ์์ ์ผ๋ก ์ ์ธ๋์ด์ผ ํฉ๋๋ค.
๋๋ ๊ทธ๋ ๊ฒ ์๊ฐ ํ์ง ์๋๋ค. ๋๋ ๋ค๋ฅธ ์ผ์ด ์ผ์ด๋๊ณ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
(์๋ง๋ ํ ์ด๋ธ ์ ์๊ฐ ํ ์คํธ ์ฌ์ด์ ์ฌ๋ฐ๋ฅด๊ฒ ์ญ์ ๋์ง ์์ต๋๊น?)
์ DB์์ org.hibernate.reactive.EagerTest#testEagerCollectionFetch
๋ง ์คํํ๋ฉด ๋ค์์ ์ป์ต๋๋ค.
INFO Version [vert.x-eventloop-thread-0] HHH000412: Hibernate ORM core version 5.4.29.Final
Using database type: MSSQLSERVER
INFO Version [vert.x-worker-thread-0] HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
INFO Dialect [vert.x-worker-thread-0] HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
INFO ReactiveIntegrator [vert.x-worker-thread-0] HRX000001: Hibernate Reactive Preview
INFO DefaultSqlClientPool [vert.x-worker-thread-0] HRX000011: SQL Client URL [jdbc:sqlserver://localhost:1433;user=SA;password=HReact@~~]
INFO DefaultSqlClientPool [vert.x-worker-thread-0] HRX000012: Connection pool size: 5
INFO DefaultSqlClientPool [vert.x-eventloop-thread-0] HRX000013: Detected driver [io.vertx.pgclient.spi.PgDriver]
INFO DefaultSqlClientPool [vert.x-eventloop-thread-0] HRX000013: Detected driver [io.vertx.mysqlclient.spi.MySQLDriver]
INFO DefaultSqlClientPool [vert.x-eventloop-thread-0] HRX000013: Detected driver [io.vertx.db2client.spi.DB2Driver]
INFO DefaultSqlClientPool [vert.x-eventloop-thread-0] HRX000013: Detected driver [io.vertx.mssqlclient.spi.MSSQLDriver]
[Hibernate] alter table Element drop constraint FKcwlxr32pujpq4d7va12w278fw
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Statement(s) could not be prepared.]
[Hibernate] alter table Node drop constraint FKnuolrnqa3oux6ln0vkqeuhsda
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Statement(s) could not be prepared.]
[Hibernate] drop table Element
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the table 'Element', because it does not exist or you do not have permission.]
[Hibernate] drop table Node
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the table 'Node', because it does not exist or you do not have permission.]
[Hibernate] drop sequence hibernate_sequence
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the sequence 'hibernate_sequence', because it does not exist or you do not have permission.]
[Hibernate] alter table Element drop constraint FKcwlxr32pujpq4d7va12w278fw
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Statement(s) could not be prepared.]
[Hibernate] alter table Node drop constraint FKnuolrnqa3oux6ln0vkqeuhsda
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Statement(s) could not be prepared.]
[Hibernate] drop table Element
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the table 'Element', because it does not exist or you do not have permission.]
[Hibernate] drop table Node
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the table 'Node', because it does not exist or you do not have permission.]
[Hibernate] drop sequence hibernate_sequence
WARN GenerationTargetToDatabase [vert.x-eventloop-thread-0] HRX000021: DDL command failed [io.vertx.mssqlclient.MSSQLException: Cannot drop the sequence 'hibernate_sequence', because it does not exist or you do not have permission.]
[Hibernate] create sequence hibernate_sequence start with 1 increment by 1
[Hibernate] create table Element (id int not null, node_id int, primary key (id))
[Hibernate] create table Node (id int not null, string varchar(255), version int, parent_id int, primary key (id))
[Hibernate] alter table Element add constraint FKcwlxr32pujpq4d7va12w278fw foreign key (node_id) references Node
[Hibernate] alter table Node add constraint FKnuolrnqa3oux6ln0vkqeuhsda foreign key (parent_id) references Node
[Hibernate] select next value for hibernate_sequence
[Hibernate] select next value for hibernate_sequence
[Hibernate] select next value for hibernate_sequence
[Hibernate] select next value for hibernate_sequence
[Hibernate] select next value for hibernate_sequence
[Hibernate] insert into Node (parent_id, string, version, id) values (<strong i="7">@P1</strong>, <strong i="8">@P2</strong>, <strong i="9">@P3</strong>, @P4)
javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
java.util.concurrent.CompletionException: javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:838)
at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:811)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at com.ibm.asyncutil.iteration.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:121)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at com.ibm.asyncutil.iteration.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:121)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at org.hibernate.reactive.pool.impl.Handlers.lambda$toCompletionStage$0(Handlers.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:128)
at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:79)
at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:198)
at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryFail(QueryResultBuilder.java:118)
at io.vertx.core.Promise.fail(Promise.java:89)
at io.vertx.core.Promise.handle(Promise.java:53)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:128)
at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:79)
at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:198)
at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:43)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.command.CommandResponse.fire(CommandResponse.java:46)
at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:261)
at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:97)
at io.vertx.core.net.impl.NetSocketImpl.lambda$new$1(NetSocketImpl.java:97)
at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:240)
at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:130)
at io.vertx.core.net.impl.NetSocketImpl.lambda$handleMessage$9(NetSocketImpl.java:390)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:49)
at io.vertx.core.impl.ContextImpl.emit(ContextImpl.java:275)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:22)
at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:389)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:153)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:154)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.vertx.mssqlclient.impl.codec.TdsMessageEncoder.lambda$write$0(TdsMessageEncoder.java:52)
at io.vertx.mssqlclient.impl.codec.MSSQLCommandCodec.complete(MSSQLCommandCodec.java:70)
at io.vertx.mssqlclient.impl.codec.ExtendedQueryCommandCodec.decodeMessage(ExtendedQueryCommandCodec.java:121)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decodeMessage(TdsMessageDecoder.java:70)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decode(TdsMessageDecoder.java:49)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decode(TdsMessageDecoder.java:27)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.reactive.session.impl.ReactiveExceptionConverter.convert(ReactiveExceptionConverter.java:31)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.lambda$doFlush$34(ReactiveSessionImpl.java:879)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:836)
... 73 more
Caused by: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
... 76 more
Caused by: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at io.vertx.mssqlclient.impl.codec.MSSQLCommandCodec.handleErrorToken(MSSQLCommandCodec.java:60)
at io.vertx.mssqlclient.impl.codec.ExtendedQueryCommandCodec.decodeMessage(ExtendedQueryCommandCodec.java:84)
... 25 more
Gradle Test Executor 34 > org.hibernate.reactive.EagerTest > testEagerCollectionFetch FAILED
java.util.concurrent.CompletionException: javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:838)
at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:811)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at com.ibm.asyncutil.iteration.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:121)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at com.ibm.asyncutil.iteration.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:121)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
at org.hibernate.reactive.pool.impl.Handlers.lambda$toCompletionStage$0(Handlers.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:128)
at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:79)
at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:198)
at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryFail(QueryResultBuilder.java:118)
at io.vertx.core.Promise.fail(Promise.java:89)
at io.vertx.core.Promise.handle(Promise.java:53)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:128)
at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:79)
at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:198)
at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:43)
at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.command.CommandResponse.fire(CommandResponse.java:46)
at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:261)
at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:97)
at io.vertx.core.net.impl.NetSocketImpl.lambda$new$1(NetSocketImpl.java:97)
at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:240)
at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:130)
at io.vertx.core.net.impl.NetSocketImpl.lambda$handleMessage$9(NetSocketImpl.java:390)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:49)
at io.vertx.core.impl.ContextImpl.emit(ContextImpl.java:275)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:22)
at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:389)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:153)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:154)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.vertx.mssqlclient.impl.codec.TdsMessageEncoder.lambda$write$0(TdsMessageEncoder.java:52)
at io.vertx.mssqlclient.impl.codec.MSSQLCommandCodec.complete(MSSQLCommandCodec.java:70)
at io.vertx.mssqlclient.impl.codec.ExtendedQueryCommandCodec.decodeMessage(ExtendedQueryCommandCodec.java:121)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decodeMessage(TdsMessageDecoder.java:70)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decode(TdsMessageDecoder.java:49)
at io.vertx.mssqlclient.impl.codec.TdsMessageDecoder.decode(TdsMessageDecoder.java:27)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by:
javax.persistence.PersistenceException: org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.reactive.session.impl.ReactiveExceptionConverter.convert(ReactiveExceptionConverter.java:31)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.lambda$doFlush$34(ReactiveSessionImpl.java:879)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:836)
... 73 more
Caused by:
org.hibernate.HibernateException: io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at org.hibernate.reactive.session.impl.ReactiveExceptionConverter.convert(ReactiveExceptionConverter.java:31)
... 75 more
Caused by:
io.vertx.mssqlclient.MSSQLException: Cannot insert the value NULL into column 'parent_id', table 'master.dbo.Node'; column does not allow nulls. INSERT fails.
at io.vertx.mssqlclient.impl.codec.MSSQLCommandCodec.handleErrorToken(MSSQLCommandCodec.java:60)
at io.vertx.mssqlclient.impl.codec.ExtendedQueryCommandCodec.decodeMessage(ExtendedQueryCommandCodec.java:84)
... 25 more
----------------------------------------------------------------
mssql results: FAILURE (1 tests, 0 passed, 1 failed, 0 skipped)
----------------------------------------------------------------
DB๊ฐ ๋น์ด ์์ผ๋ฉด ์ฒซ ๋ฒ์งธ ๊ฒฝ๊ณ ๊ฐ ์์๋ฉ๋๋ค. ๊ทธ๋ฌ๋ฉด ํ ์คํธ ์ค์ ์ด ์ ์์ ์ผ๋ก ๋ณด์ ๋๋ค.
[Hibernate] create sequence hibernate_sequence start with 1 increment by 1
[Hibernate] create table Element (id int not null, node_id int, primary key (id))
[Hibernate] create table Node (id int not null, string varchar(255), version int, parent_id int, primary key (id))
[Hibernate] alter table Element add constraint FKcwlxr32pujpq4d7va12w278fw foreign key (node_id) references Node
[Hibernate] alter table Node add constraint FKnuolrnqa3oux6ln0vkqeuhsda foreign key (parent_id) references Node
MSSQLException: Cannot drop the table 'Node', because it does not exist or you do not have permission.]
์ด๊ฒ์ ํ์คํ ์ง์ง ์ด์ ์ ๋๋ค.
์ด๊ฒ์ ํ์คํ ์ง์ง ์ด์ ์ ๋๋ค.
์ค, ๋ฏธ์ ํด์, ๋ด ๋์, ์๋, ์ด์ ๊ฐ ์๋์์.
์ ๋ง ์๋ฌด ์๊ฐ์ด ์์ต๋๋ค. SQL Server ์ธ๋ ํค๊ฐ ๊ธฐ๋ณธ์ ์ผ๋ก not null
๊ฒฝ์ฐ๊ฐ ์๋๋ฏ๋ก ๋ค๋ฅธ ์ผ์ด ๋ฐ์ํด์ผ ํฉ๋๋ค.
๋ด ๋ง์ด ์ฌ์ค์ธ์ง ํ์ธํ๊ธฐ ์ํด GUI ํด๋ผ์ด์ธํธ์์ ๋์ผํ SQL์ ์คํํด ๋ณด์ จ์ต๋๊น?
์๋์ค. ๋๋ ๊ทธ๊ฒ์ ์๋ ํ ๊ฒ์ ๋๋ค
>
sqlcmd
์์ ์ด๊ฒ์ ์คํํ ๋ ์๋ํฉ๋๋ค.
1> create sequence hibernate_sequence start with 1 increment by 1
2> go
1> create table Element (id int not null, node_id int, primary key (id))
2> go
1> create table Node (id int not null, string varchar(255), version int, parent_id int, primary key (id))
2> go
1> alter table Element add constraint FKcwlxr32pujpq4d7va12w278fw foreign key (node_id) references Node
2> go
1> alter table Node add constraint FKnuolrnqa3oux6ln0vkqeuhsda foreign key (parent_id) references Node
2> go
1> insert into Node (parent_id, string, version, id) values (null, 'parent',0, 1)
2> go
(1 rows affected)
1> select * from Node
2> go
id string version parent_id
----------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- -----------
1 parent 0 NULL
(1 rows affected)
1> exit
๊ทธ๋์ ๋น์ ์ด ์ณ์ต๋๋ค. ๊ทธ๊ฒ์ ์ ์ฝ ์กฐ๊ฑด ์ ์์ ๊ด๋ จ์ด ์์ต๋๋ค.
@tsegismont MSSQLException
์์ฑ์์์ ์ค๋จ์ ์ ์ฌ์ฉํ์ฌ EagerTest
๋ฅผ ๋๋ฒ๊น
ํ ๋ MSSQLException
๋ฉ์์ง์ ํจ๊ป "'?' ๊ทผ์ฒ์ ๊ตฌ๋ฌธ์ด ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค." ์์ฑ๋ฉ๋๋ค.
๊ทธ ์์ธ๋ ๋จนํ ๊ฒ ๊ฐ๊ณ ๋์ "Statement(s) could not be ready"๋ผ๋ ๋ฉ์์ง์ ํจ๊ป MSSQLException
๊ฐ ๋ฐ์ํฉ๋๋ค.
Vert.x 4.1.0-SNAPSHOT์ ์ฌ์ฉํ์ฌ ๋ค๋ฅธ ํ ์คํธ๋ฅผ ๋๋ฒ๊น ํ ๋๋ ๋์ผํ ์ข ๋ฅ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
@gbadner https://github.com/DavidD/hibernate-reactive/pull/13 (ํนํ SQL Server์ ๋ํ Parameters
ํด๋์ค ๊ตฌํ)์์ ๊ณต์ ํ ๋ณ๊ฒฝ ์ฌํญ์ด ํ์ํฉ๋๋ค.
์ ๋ SQL Server๋ก ์งํ ์ํฉ์ ์ถ์ ํ๊ธฐ ์ํด ๋ถ๊ธฐ ์ ์คํธ๋ฆผ์ ๋ง๋ค ๊ฒ์ ๋๋ค. ๊ทธ๋์ผ ์ต์ ๋ฉ์ธ์ผ๋ก ๋ฆฌ๋ฒ ์ด์คํ๊ณ ๋ชจ๋ ๋ณ๊ฒฝ ์ฌํญ์ด ์๋ ์ฐธ์กฐ ๋ถ๊ธฐ๋ฅผ ๊ฐ์ง ์ ์์ต๋๋ค.
@tsegismont ์ํ๊ฐ ์ด๋ค๊ฐ์?
(๋ฌธ์ ๊ฐ ๋ฌด์์ด๋ ๋ฌธ์ ์ค๋ช ์ด ๋ฌธ์ ๋ฅผ ํ์ ํ์ง ๋ชปํ๋ค๊ณ ์๊ฐํฉ๋๋ค.)
@gavinking ์์ง ์กฐ์ฌํ์ง ๋ชปํ์ต๋๋ค
@gavinking ๋ฐฉ์ธ ๊ตฌํ์ ๋ณ๊ฒฝํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
Index: hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java
--- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java (revision dd82c137dcdc3cf5a388ae427e1ec042a9d9552c)
+++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java (date 1621943075708)
@@ -135,10 +135,18 @@
return CockroachDB201Dialect.class;
}
else if ( url.startsWith("sqlserver:") ) {
- return SQLServer2012Dialect.class;
+ return SpecialSQLServer2012Dialect.class;
}
else {
return null;
}
}
+
+ public static class SpecialSQLServer2012Dialect extends SQLServer2012Dialect {
+
+ <strong i="7">@Override</strong>
+ public String getNullColumnString() {
+ return " null";
+ }
+ }
}
์ด์ ๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง ๋ช ์์ ์ผ๋ก nullable๋ก ์ง์ ๋์ง ์์ ๊ฒฝ์ฐ(Sybase์ ๊ฐ์ด) ์๋ฒ๊ฐ nullable์ด ์๋ ์ด์ ์์ฑํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฒจ์ด ์ธ๋ฆฌ๋์?
๋ด ๋ง์, ๊ทธ ๋ฐฉ์ธ์ ๋ช ๋ ๋์ Hibernate ORM์์ ์ฌ์ฉ๋ ๊ฒ์ด๋ฏ๋ก ๊ทธ๊ฒ์ด ์ด๋ป๊ฒ ํ๋ฆด ์ ์๋์ง ๋ณด๊ธฐ ์ด๋ ต์ต๋๋ค(SQL ์๋ฒ JDBC ๋๋ผ์ด๋ฒ๊ฐ ์ด์ํ ์ผ์ ํ์ง ์๋ ํ).
์ฌ๊ธฐ ๋ด๊ฐ ์ฐพ์ ๊ฒ์ด ์์ต๋๋ค.
์ด ๋์์ ์ํฅ์ ์ค ์ ์๋ ๋ช ๊ฐ์ง ์ค์ ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๋ค์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ๋ฐ๋ฅธ ์ผ์ ํด์ผ ํฉ๋๋ค.
๋๋ถ๋ถ์ ์ต์ ์ฐ๊ฒฐ์ ์ฐ๊ฒฐ๋ ๋ ์๋์ผ๋ก
SET ANSI_NULL_DEFAULT_ON
๋ฅผ ์ํํฉ๋๋ค.
์๋ง๋ ๋น์ ์ ๊ทธ๊ฒ์ ์๋ํด์ผํฉ๋๋ค.
@gavinking์ ํตํด ์ด๊ฒ์ด ์๋ฒ ๊ตฌ์ฑ ๋๋ฌธ์ธ์ง ๋๋ Reactive Client๊ฐ ์ํํ์ง ์๋ JDBC ๋๋ผ์ด๋ฒ๊ฐ ์ํํ๋ ์์ ์ธ์ง ํ์ธํ ์ ์์ต๋๋ค.
์ด ๊ฒฝ์ฐ ์ ์คํธ๋ฆผ์ ๋ฌธ์ ๋ฅผ ๋ง๋ค๊ณ ์ด ๋ฌธ์ ๋ฅผ ๋ซ์ ์ ์์ต๋๋ค.
@gavinking ์ด ํจ๊ณผ๊ฐ ์์์ต๋๋ค.
๋ฌธ์ ์ ์คํธ๋ฆผ์ ์ถ์ ํ๊ธฐ ์ํด https://github.com/eclipse-vertx/vertx-sql-client/issues/963 ์ ์ ์ถํ์ต๋๋ค.
์ด ํญ๋ชฉ์ ๋ซ์ผ์ญ์์ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์ ์คํธ๋ฆผ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด ๋์ค์ ๋ซ์ ์ ์์ต๋๋ค.
์์์ด ๊ณ ๋ง์. ๋๋ ๋ฌธ์ ๊ฐ ์ฌ๊ธฐ์ ์ํ์ง ์๋๋ค๊ณ ์๊ฐํ๋ฏ๋ก ์ด๊ฒ์ ๋ซ์ต๋๋ค.