Customisation of the RegNo
This commit is contained in:
parent
0c73f6f44d
commit
79f4b84b70
@ -3,10 +3,11 @@ package ovh.herisson.Clyde;
|
||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class RegNoGenerator implements IdentifierGenerator {
|
||||
private final UserSaveCounter usv = UserSaveCounter.getInstance();
|
||||
@ -24,8 +25,9 @@ public class RegNoGenerator implements IdentifierGenerator {
|
||||
|
||||
ResultSet set = statement.executeQuery(query);
|
||||
long resp = 0;
|
||||
Calendar c = new GregorianCalendar();
|
||||
if(set.next()){
|
||||
resp = set.getLong(1)+1000;
|
||||
resp = set.getLong(1)+((c.get(Calendar.YEAR)%1000)*10000);
|
||||
System.out.println(resp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user