wood burning stoves 2.0*
The moose likes JDBC and the fly likes Mapping ResultSet to Pojo class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Mapping ResultSet to Pojo class" Watch "Mapping ResultSet to Pojo class" New topic
Author

Mapping ResultSet to Pojo class

vicky yar
Greenhorn

Joined: Feb 02, 2012
Posts: 3
Hy. I have made a standard pojo class and its dao class for data retrieval purpose. I am having a difficulty to understand a basic procedure to how to handle a customized query data to Pojo class.

let's say my User class is

now how I should model this with my pojo class as if using String to manage this then concept of object oriented vanishes, also complexity would increase in the future as well. kindly guide!


Update for Further Explanation

We know that we can map same table objects with same pojo class, but when the query is customized and there is a data returned which doesn't map to any specific class then what would be the procedure? i.e. should we make another class? or should we throw that data in a String variable? kindly give some example as well.
Malatesh Karabisti
Ranch Hand

Joined: Jul 28, 2010
Posts: 153

There are some guide lines here
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

Vicky,
Welcome to CodeRanch!

I don't understand what you mean by this:
but when the query is customized and there is a data returned which doesn't map to any specific class then what would be the procedure


Do you mean there is a column returned that doesn't go with user/address? Which shouldn't happen since you wrote the SQL. Or something else. Maybe you can give an example of "something else" that could be returned.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping ResultSet to Pojo class