I want to generate Sequential Trnsaction ID's for employees to store in the Database ... I wrote the below jsp code(This ain't the code to insert Tx ID in the database) ..The code works fine .. When i use order by clause to see the latest transaction ..i'm not getting the expected transation ID...How can i make the transaction ID's unique , Sequential so that i can retrieve them in a particular sequence by using Order By clause?
  <%
         String url = "jdbc:mysql://localhost:3306/";
        String dbName = "ystem";
        String driver = "com.mysql.jdbc.Driver";
        String userName = "root";
        String password = "";
        try {
            Class.forName(driver).newInstance();
            Connection conn = DriverManager.getConnection(url+dbName,userName,password);
            Statement stat=conn.createStatement();
            ResultSet rs=stat.executeQuery("select count(*) from `employee`");
            int x=0;
            UUID idOne = UUID.randomUUID();
            while(rs.next()) {                    
                x=Integer.parseInt(rs.getString(1))+1;
            }
            out.println(idOne.toString().toUpperCase()+"-"+String.valueOf(x));
                        stat.close(); conn.close();
        }
        catch(Exception x) {
            out.println(x.getMessage());
        }
    %>
 
    