Blazebit: java.math.BigDecimal cannot be cast to class java.lang.Long

392 Views Asked by At

I am using Blazebit and Deltaspike in a jakarta ee project. The database is oracle.

https://github.com/joedayz/curso-java-sbs/tree/main/comparabienangular/concentrador-oracle

In it repo, my problem is in the class ConsultaProductoServiceImpl and method "consulta". I receive the data from a frontend web application but when execute the findAll with specification, I got it error:

[2022-12-18T18:04:13.470-0500] [Payara 5.2021.4] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=117 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1671404653470] [levelValue: 900] [[
  StandardWrapperValve[pe.farmaciasperuanas.concentrador.controller.ConcentradorRestApplication]: Servlet.service() for servlet pe.farmaciasperuanas.concentrador.controller.ConcentradorRestApplication threw exception
java.lang.ClassCastException: class java.math.BigDecimal cannot be cast to class java.lang.Long (java.math.BigDecimal and java.lang.Long are in module java.base of loader 'bootstrap')
    at com.blazebit.persistence.impl.PaginatedTypedQueryImpl.getResultList(PaginatedTypedQueryImpl.java:441)
    at com.blazebit.persistence.impl.PaginatedTypedQueryImpl.getResultList(PaginatedTypedQueryImpl.java:218)
    at com.blazebit.persistence.impl.PaginatedTypedQueryImpl.getResultList(PaginatedTypedQueryImpl.java:58)
    at com.blazebit.persistence.deltaspike.data.base.handler.AbstractEntityViewAwareRepositoryHandler.findAll(AbstractEntityViewAwareRepositoryHandler.java:322)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder.invoke(EntityViewDelegateQueryBuilder.java:113)
    at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder.execute(EntityViewDelegateQueryBuilder.java:61)
    at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewQueryBuilder.executeQuery(EntityViewQueryBuilder.java:37)
    at com.blazebit.persistence.deltaspike.data.impl.builder.EntityViewDelegateQueryBuilder$Proxy$_$$_WeldClientProxy.executeQuery(Unknown Source)
    at com.blazebit.persistence.deltaspike.data.impl.handler.TransactionalEntityViewQueryRunner.executeNonTransactional(TransactionalEntityViewQueryRunner.java:58)
    at com.blazebit.persistence.deltaspike.data.impl.handler.TransactionalEntityViewQueryRunner.executeQuery(TransactionalEntityViewQueryRunner.java:54)
    at com.blazebit.persistence.deltaspike.data.impl.handler.TransactionalEntityViewQueryRunner$Proxy$_$$_WeldClientProxy.executeQuery(Unknown Source)
    at com.blazebit.persistence.deltaspike.data.impl.handler.EntityViewAwareQueryHandler.process(EntityViewAwareQueryHandler.java:101)
    at org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:130)
    at com.blazebit.persistence.deltaspike.data.impl.handler.EntityViewAwareQueryHandler$Proxy$_$$_WeldClientProxy.invoke(Unknown Source)
    at org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler.proceed(DeltaSpikeProxyInvocationHandler.java:97)
    at org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler.invoke(DeltaSpikeProxyInvocationHandler.java:78)
    at org.apache.deltaspike.proxy.spi.invocation.DeltaSpikeProxyInvocationHandler$Proxy$_$$_WeldClientProxy.invoke(Unknown Source)
    at pe.farmaciasperuanas.concentrador.repository.ConsultaEntidadProductoRepository$$DSPartialBeanProxy.findAll(Unknown Source)
    at pe.farmaciasperuanas.concentrador.service.impl.ConsultaProductoServiceImpl.consulta(ConsultaProductoServiceImpl.java:45)
    at pe.farmaciasperuanas.concentrador.controller.ConsultaEntidadProductoController.consulta(ConsultaEntidadProductoController.java:30)
    at pe.farmaciasperuanas.concentrador.controller.ConsultaEntidadProductoController$Proxy$_$$_WeldClientProxy.consulta(Unknown Source)

In the Database the structure of the table is:

create table DETALLEPRODUCTOFINANCIERO
(
    DETALLEPRODUCTOFINANCIEROID NUMBER(19) generated as identity
        primary key,
    PRODUCTOFINANCIEROID        NUMBER(19)
        constraint FK_DETALLEPRODUCTOFINANCIERO_PRODUCTOFINANCIEROID
            references PRODUCTOFINANCIERO,
    TIPOMONEDAID                NUMBER,
    INGRESOPERMITIDO            NUMBER,
    MONTOMINIMOPRESTAMO         NUMBER,
    MONTOMAXIMOPRESTAMO         NUMBER,
    MONTOMINIMODEPOSITO         NUMBER,
    MONTOMAXIMODEPOSITO         NUMBER
)
/

and

create table PRODUCTOFINANCIERO
(
    PRODUCTOFINANCIEROID NUMBER(19) generated as identity
        primary key,
    TIPOPRODUCTOID       NUMBER(4),
    ENTIDADFINANCIERAID  NUMBER(19)
        constraint FK_PRODUCTOFINANCIERO_ENTIDADFINANCIERAID
            references ENTIDADFINANCIERA,
    NOMBRE               VARCHAR2(100),
    DESCRIPCION          VARCHAR2(200),
    PORCENTAJETEA        NUMBER(10, 2),
    PORCENTAJECOMISION   NUMBER(10, 2),
    PORCENTAJESEGURO     NUMBER(10, 2),
    OBSERVACION          VARCHAR2(500),
    PLAZOMINIMOMES       NUMBER,
    PLAZOMAXIMOMES       NUMBER,
    PLAZOMINIMODIA       NUMBER,
    PLAZOMAXIMODIA       NUMBER,
    TIENEFONDOSEGURO     CHAR,
    USUARIOREGISTRO      VARCHAR2(100),
    FECHAREGISTRO        TIMESTAMP(6),
    USUARIOMODIFICA      VARCHAR2(100),
    FECHAMODIFICACION    TIMESTAMP(6),
    ACTIVO               CHAR
)

I don't know, what is the error. Any idea?

0

There are 0 best solutions below