I am getting below invalid Number exception while executing query. please help me on this. Same query executed properly in DB.
Note: While passing amount with decimal (12.87) I am getting error and With out decimal it works well.
Code:
@PersistenceContext private EntityManager em;
Query = query =em.createNativeQuery(sql, class.forName(search.getDBEntityClassName())); List result = query.getResultList();
Table Defination:
View: VW_SEARCH_TMP
AMOUNT : NUMBER (11,2); // when search with numeric (10) works well. But with decimal (10.12) getting error ID: NUMBER(11);
Query: ReadAllQuery(referenceClass=VwSearchCheque sql="SELECT * FROM (SELECT * FROM VW_SEARCH_TMP WHERE ID = ? AND CHEQUE_NO LIKE ? ESCAPE '' AND AMOUNT = ? ORDER BY ISSUE_DATE ASC) WHERE ROWNUM<=501 ")
O [EL Warning]: 2020-10-29 16:26:05.799--UnitOfWork(1908522008)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number
Error Code: 1722
at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378) at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260) at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:375) at com.sun.proxy.$Proxy161.getResultList(Unknown Source) at ca.on.jus.tms.searchEngine.service.SearchServiceImpl.search(SearchServiceImpl.java:179) at ca.on.jus.tms.web.controller.search.SearchController.searchEntity(SearchController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) Caused by: org.eclipse. persistence.exceptions.DatabaseException: Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number
While passing amount with decimal (12.87) I am getting error and With out decimal it works well
It looks like decimal point character isn't dot, but comma.
Try 12,87
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.