Link to home
Start Free TrialLog in
Avatar of coolgem
coolgem

asked on

Java: After comparing how to get the record(s) I need?

Hi if the date from an sql while.next is different then Inhow do I get it?
this is what I have so far(up to this point):
while (result.next()) {
String currentDate = result.getString("AUTH_START_DTM");
if (prevStartDate != null) {
int comparison = prevStartDate.compareTo(currentDate);
prevStartDate = currentDate;
ReleaseAuth releas = new ReleaseAuth();
releas.setSsn(result.getString("SSN"));  

What do I do after the comparison line?
Thank you
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

How do you want it compared?
Avatar of coolgem
coolgem

ASKER

If the current date is different from the  previous start date then I want to make a new ReleasAuth object and then fill in the other fields obtained from the data base.
I'm confused about that comparison statement where the integer is obtained after the comparison.  
Thank you again.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of coolgem

ASKER

ok thank you again cg
:-)

>>I'm confused about that comparison statement where the integer is obtained after the comparison.  

That's done per the spec of the Comparable interface:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)
Avatar of coolgem

ASKER

thank you also Kanti