Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping BigInteger java object into a ResultSet Data Type

 
Vikki Fiawoo
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try user.setUserId(new BigInteger(Integer.valueOf(rs.getInt("User_Id")).toString()));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic