This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Assigning values from ResultSet to objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Assigning values from ResultSet to objects" Watch "Assigning values from ResultSet to objects" New topic
Author

Assigning values from ResultSet to objects

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hi,

Could you please tell me how to assign values from ResultSet to objects.

Suppose I have an Employee class with a String name as instance variable and setName() setter method.
And I have a table company which has a column named 'EmployeeName'

When ResultSet returns the values.
e.g.
So, how to assign the EmployeeName data to new Employee().name ?

Thanks,
Pramod
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
Isn’t it something like String employeeName = rs.getString(...);
There is a page in the Java Tutorials (about 6 lines down) about result sets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assigning values from ResultSet to objects
 
Similar Threads
Using EL to retrive data from Arraylist
Sentinel-controlled loop with a String variable condition
Connection Failing
Sorting problem with HibernateSqlQuery with Websphere
h:selectOneMenu - setting the correct value