{noformat} @Column @JdbcTypeCode( Types SqlTypes .VARBINARY) private char[] charArray;{noformat}
The above does not work, one gets an exception upon trying to persist:
{noformat}org.hibernate.HibernateException: Unknown unwrap conversion requested: [C to [B : `org.hibernate.type.descriptor.java.PrimitiveCharacterArrayJavaType` ([C)
at org.hibernate.type.descriptor.java.JavaTypeHelper.unknownUnwrap(JavaTypeHelper.java:17) at org.hibernate.type.descriptor.java.AbstractClassJavaType.unknownUnwrap(AbstractClassJavaType.java:112) at org.hibernate.type.descriptor.java.PrimitiveCharacterArrayJavaType.unwrap(PrimitiveCharacterArrayJavaType.java:74) at org.hibernate.type.descriptor.java.PrimitiveCharacterArrayJavaType.unwrap(PrimitiveCharacterArrayJavaType.java:23) at org.hibernate.type.descriptor.jdbc.VarbinaryJdbcType$1.doBind(VarbinaryJdbcType.java:100) at org.hibernate.type.descriptor.jdbc.BasicBinder.bind(BasicBinder.java:61) at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.lambda$beforeStatement$0(JdbcValueBindingsImpl.java:87) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.hibernate.engine.jdbc.mutation.spi.BindingGroup.forEachBinding(BindingGroup.java:51) at org.hibernate.engine.jdbc.mutation.internal.JdbcValueBindingsImpl.beforeStatement(JdbcValueBindingsImpl.java:85) at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.performNonBatchedMutation(AbstractMutationExecutor.java:93) at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:40) at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:43) at org.hibernate.persister.entity.mutation.InsertCoordinator.doStaticInserts(InsertCoordinator.java:162) at org.hibernate.persister.entity.mutation.InsertCoordinator.coordinateInsert(InsertCoordinator.java:104) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2785) at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:102) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:616) at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:487) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:484) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:358) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1412) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:485) at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2277) at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:1942) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:426) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:169) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:267) at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101){noformat} |
|