|Mapping Oracle NUMBER type to Java Type Options [message #1064735]
||Thu, 20 June 2013 17:34
| John Worley
Registered: July 2009
I have a project where Oracle is the database and ID columns are type NUMBER(32). The JPA entity classes are using Java BigDecimal as the field mappings to those Oracle ID columns. That works of course but since the purpose of the database column is to just be an integer value, I was wondering if it would be more efficient to use Java Integer.|
In testing this I made some JPA entity classes that used Java Integer for the NUMBER(32)columns. That works with regular queries and native queries for data.
I run into a problem when I try a single column fetch using a native query though.
For example - SELECT someIdColumn FROM someTable
...where I try to map the results into a List<Integer> or List<BigInteger>
In that test I get an exception that says I can't cast BigDecimal to Integer. So the EntityManager is automatically mapping the Oracle NUMBER(32) to a BigDecimal. Is there a way I can tell it to use something else instead of BigDecimal?
Powered by FUDForum
. Page generated in 0.02017 seconds