How to map java.sql.types to Java classes?

Dear Experts,

I'm retrieving JDBC metadata, including java.sql.types, from a ResultSet.  Based on that, I need a factory method that will return the data from each column in a separate appropriate Java class.  For instance, a java.sql.Types.DECIMAL should be returned as a java.math.BigDecimal.  

Is anyone aware of an existing method that will do this for me?  At least, is there an existing Map representing which conversions should be done?

Thanks!
McJava1967
McJava1967Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
How would you use that btw?
0
McJava1967Author Commented:
It's a bit convoluted.  
I'm receiving a map of field names and values, and the name of a stored procedure.  I need to convert the map into parameters for the stored procedure.  But the values are all strings.  I need to pull the real types from the stored procedure (I have that worked out), and then cast those strings to an appropriate Java class.  Then I'll use a Spring StoredProcedure class to pass them in.
0
quincydudeCommented:
Hi, I do not know any mapping but just to help you by giving you more information about the matching types. You can have a look at the set methods in

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html

it lists the java equivalent of sql types. And hopefully you can create you own mapping afterwards.

Good luck!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.