Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assigning values from ResultSet to objects  RSS feed

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn’t it something like String employeeName = rs.getString(...);
There is a page in the Java Tutorials (about 6 lines down) about result sets.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!