Adapt the condition
This commit is contained in:
parent
9328601d2d
commit
49b99e14c9
@ -20,14 +20,15 @@ public class RegNoGenerator implements IdentifierGenerator {
|
|||||||
Statement statement = conn.createStatement();
|
Statement statement = conn.createStatement();
|
||||||
|
|
||||||
int n = usv.getCount();
|
int n = usv.getCount();
|
||||||
String query = "select count(reg_no)+"+n+" from Users";
|
Calendar c = new GregorianCalendar();
|
||||||
usv.increment();
|
int y = c.get(Calendar.YEAR);
|
||||||
|
String query = "select count(reg_no) + "+n+" from Users where reg_no/10000 = " + y%1000;
|
||||||
|
|
||||||
ResultSet set = statement.executeQuery(query);
|
ResultSet set = statement.executeQuery(query);
|
||||||
long resp = 0;
|
long resp = 0;
|
||||||
Calendar c = new GregorianCalendar();
|
|
||||||
if(set.next()){
|
if(set.next()){
|
||||||
resp = set.getLong(1)+((c.get(Calendar.YEAR)%1000)*10000);
|
resp = set.getLong(1)+((y%1000)*10000);
|
||||||
|
usv.increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.close();
|
conn.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user