We are facing following exception while using with latest version of quarkus and we are using quarkus-hibernate-orm-3.0.1.Final. This code use to work with older version of hibernate.
Suppressed: io.smallrye.reactive.messaging.providers.ProcessingException: SRMSG00103: Exception thrown when calling the method com.acme.consumer.processor.Consumer#processEvent
at io.smallrye.reactive.messaging.providers.ProcessorMediator.handlePostInvocation(ProcessorMediator.java:369)
at io.smallrye.reactive.messaging.providers.ProcessorMediator.lambda$processMethodReturningACompletionStageOfPayloadAndConsumingIndividualItem$51(ProcessorMediator.java:423)
at io.smallrye.context.impl.wrappers.SlowContextualBiFunction.apply(SlowContextualBiFunction.java:21)
at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.performInnerSubscription(UniOnItemOrFailureFlatMap.java:86)
... 39 more
Caused by: org.hibernate.type.descriptor.java.CoercionException: Error coercing value
at org.hibernate.type.descriptor.java.CoercionHelper.coerceWrappingError(CoercionHelper.java:396)
at org.hibernate.type.descriptor.java.IntegerJavaType.coerce(IntegerJavaType.java:182)
at org.hibernate.type.descriptor.java.IntegerJavaType.coerce(IntegerJavaType.java:24)
at org.hibernate.loader.internal.IdentifierLoadAccessImpl.doLoad(IdentifierLoadAccessImpl.java:176)
at org.hibernate.loader.internal.IdentifierLoadAccessImpl.lambda$load$1(IdentifierLoadAccessImpl.java:160)
at org.hibernate.loader.internal.IdentifierLoadAccessImpl.perform(IdentifierLoadAccessImpl.java:107)
at org.hibernate.loader.internal.IdentifierLoadAccessImpl.load(IdentifierLoadAccessImpl.java:160)
at org.hibernate.internal.SessionImpl.find(SessionImpl.java:2401)
at org.hibernate.internal.SessionImpl.find(SessionImpl.java:2367)
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.find(TransactionScopedSession.java:175)
at org.hibernate.engine.spi.SessionLazyDelegator.find(SessionLazyDelegator.java:784)
at org.hibernate.Session_3a974b6a18ac399f675913d732c105426414d370_Synthetic_ClientProxy.find(Unknown Source)
at com.acme.consumer.repository.CustomerRepository.findByCustomerId(CustomerRepository.java:27)
at com.acme.consumer.repository.CustomerRepository_Subclass.findByCustomerId$$superforward(Unknown Source)
at com.acme.consumer.repository.CustomerRepository_Subclass$$function$$1.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:74)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:63)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:136)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:107)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:38)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:26)
at com.acme.consumer.repository.CustomerRepository_Subclass.findByCustomerId(Unknown Source)
at com.acme.consumer.repository.CustomerRepository_ClientProxy.findByCustomerId(Unknown Source)
at com.acme.consumer.service.CustomerService.findByCustomerId(CustomerService.java:23)
at com.acme.consumer.service.CustomerService_ClientProxy.findByCustomerId(Unknown Source)
at com.acme.consumer.service.BService.process(BService.java:41)
at com.acme.consumer.service.BService_ClientProxy.process(Unknown Source)
at com.acme.consumer.processor.Consumer.lambda$processEvent$0(Consumer.java:32)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
... 6 more
Caused by: java.lang.NumberFormatException: For input string: "2020110000107"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:668)
at java.base/java.lang.Integer.parseInt(Integer.java:786)
at org.hibernate.type.descriptor.java.IntegerJavaType.lambda$coerce$0(IntegerJavaType.java:183)
at org.hibernate.type.descriptor.java.CoercionHelper.coerceWrappingError(CoercionHelper.java:393)
... 39 more
[CIRCULAR REFERENCE:org.hibernate.type.descriptor.java.CoercionException: Error coercing value]
This is how my entity looks
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.*;
/**
* The persistent class for the customer database table.
*
*/
@Builder
@AllArgsConstructor
@Entity
@NoArgsConstructor
@Getter
@Setter
@ToString
@Table(name = "CUSTOMER")
//@EqualsAndHashCode(callSuper=false)
public class Customer extends PanacheEntityBase{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID", nullable = false, length = 11)
private Integer id;
@Column(name="CUSTOMER_ID", length = 50, unique=true, nullable = false)
private String customerId;
@Column(name = "NAME", length = 50, nullable =false)
private String name;
@JoinColumn(name = "PARENT_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne(fetch = FetchType.LAZY)
private Customer parentId;
}
And this is our repository code
@Transactional(REQUIRED)
public Customer findByCustomerId(String customerId) throws CustomException {
logger.info("customerId: "+customerId);
Customer entity=entityManager.find(Customer.class,customerId);
if(entity == null){
throw new CustomException("Customer with id of " + customerId + " does not exist.");
}
return entity;
}
customerId is of type String then why hibernate gives an error and why it was working with older version(I believe it is 5.4) of hibernate.