aspose file tools
The moose likes JDBC and the fly likes Mapping BigInteger java object into a ResultSet Data Type Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Mapping BigInteger java object into a ResultSet Data Type" Watch "Mapping BigInteger java object into a ResultSet Data Type" New topic
Author

Mapping BigInteger java object into a ResultSet Data Type

Vikki Fiawoo
Greenhorn

Joined: Oct 22, 2010
Posts: 11
I have a simple question that has been driving me crazy for a few hours. I have researched all of over the web and cannot still seem to figure it out.

I have variable that I have set to a BigInteger. For example,



The this value is stored in the database as a tinyint.



I want to retrieve the data from the database using a resultset. I have tried several different datatypes and none of them are working. I am keep getting an error when I try to build my code. Here are some examples that I have tried to use:



I was also thinking that I need to explicitly convert the result set into a BigInteger.
Can someone please help with the mapping of my java BigInteger datatype and the correct sql datatype to use in my resultset. An example of this mapping would be extremely helpful


joy b chakravarty
Ranch Hand

Joined: May 16, 2011
Posts: 62

try user.setUserId(new BigInteger(Integer.valueOf(rs.getInt("User_Id")).toString()));


Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Mapping BigInteger java object into a ResultSet Data Type
 
Similar Threads
what is hibernate data type?
Hibernate foreign key
delete cascade problem
Mapping ENUM('0', '1') or CHAR(0) for Boolean
hibernate hello world