java.lang.NumberFormatException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • NumberFormatException
    via GitHub by leventov
    ,
  • GitHub comment 447#190843781
    via GitHub by aleshkanet
    ,
  • Calling {code} roleRepository.findAll(Arrays.asList(1, 2)); {code} results in {code} Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.h2.jdbc.JdbcSQLException: Datenumwandlungsfehler beim Umwandeln von "(1, 2)" Data conversion error converting "(1, 2)"; SQL statement: SELECT ID, NAME FROM PBT_ROLE WHERE (ID IN ((?,?))) [22018-192] Error Code: 22018 Call: SELECT ID, NAME FROM PBT_ROLE WHERE (ID IN ((?,?))) bind => [1, 2] Query: ReadAllQuery(referenceClass=RoleEntity sql="SELECT ID, NAME FROM PBT_ROLE WHERE (ID IN (?))") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:684) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:560) at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2056) at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:694) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2740) at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2693) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:559) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1175) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1134) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:460) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1222) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804) at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:258) ... 59 more Caused by: org.h2.jdbc.JdbcSQLException: Datenumwandlungsfehler beim Umwandeln von "(1, 2)" Data conversion error converting "(1, 2)"; SQL statement: SELECT ID, NAME FROM PBT_ROLE WHERE (ID IN ((?,?))) [22018-192] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:168) at org.h2.value.Value.convertTo(Value.java:1011) at org.h2.mvstore.db.MVSecondaryIndex.convertToKey(MVSecondaryIndex.java:322) at org.h2.mvstore.db.MVSecondaryIndex.find(MVSecondaryIndex.java:258) at org.h2.mvstore.db.MVSecondaryIndex.find(MVSecondaryIndex.java:254) at org.h2.index.BaseIndex.find(BaseIndex.java:128) at org.h2.index.IndexCursor.find(IndexCursor.java:169) at org.h2.table.TableFilter.next(TableFilter.java:466) at org.h2.command.dml.Select.queryFlat(Select.java:541) at org.h2.command.dml.Select.queryWithoutCache(Select.java:654) at org.h2.command.dml.Query.query(Query.java:341) at org.h2.command.dml.Query.query(Query.java:309) at org.h2.command.dml.Query.query(Query.java:36) at org.h2.command.CommandContainer.query(CommandContainer.java:110) at org.h2.command.Command.executeQuery(Command.java:201) at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:110) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1009) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644) ... 79 more Caused by: java.lang.NumberFormatException at java.math.BigDecimal.<init>(BigDecimal.java:494) at java.math.BigDecimal.<init>(BigDecimal.java:383) at java.math.BigDecimal.<init>(BigDecimal.java:806) at org.h2.value.Value.convertTo(Value.java:961) ... 95 more {code} The same exception is thrown if you try to declare the following repository method: {code} List<RoleEntity> findByIdIsIn(List<Integer> ids); {code} The problem is with Spring Data building the query. EclipseLink expects {{e.id IN ?}} but String Data does {{e.id IN ((?, ?))}}, which itself is incorrect as it should be {{e.id IN (?, ?)}} (only one pair of parenthesis). --------------- Current workaround is: {code} @Query("select r from RoleEntity r where r.id in :ids") List<RoleEntity> findByIds(@Param("ids") List<Integer> ids); {code}
    via by Igor Mukhin,
    • java.lang.NumberFormatException at java.math.BigDecimal.<init>(BigDecimal.java:494) at java.math.BigDecimal.<init>(BigDecimal.java:383) at java.math.BigDecimal.<init>(BigDecimal.java:806) at scala.math.BigDecimal$.exact(BigDecimal.scala:125) at scala.math.BigDecimal$.apply(BigDecimal.scala:283)

    Users with the same issue

    marcbouvierdav
    2 times, last one,
    aldrinleal
    2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    14 more bugmates