I have code that auto increments ids and it works fine. But when I serialize the instance and load it again with existing ID the new ones are counting from 1. Is there a way that if I have ID1 and ID2 existing the new one would be 3 not 1?
String fName;
String lName;
String address;
String phoneNum;
int ID;
static int PAT_ID = 1;
ArrayList<Invoice> p_invoiceList;
public Patient(String fName, String lName, String address, String phoneNum) {
super(fName, lName, address, phoneNum);
p_invoiceList = new ArrayList<Invoice>();
ID = PAT_ID;
PAT_ID++;
}
public int getId() {
return ID;
}