title: Auto generate id in java and total id count
body: <p>Actually, i got a stress in this problem.
  I have an image </p>
  
  <p><a href="https://i.stack.imgur.com/dol2S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dol2S.png" alt="enter image description here"></a></p>
  
  <p>So Im getting 2 problems here.</p>
  
  <ol>
  <li>How can I insert the auto generate id with format starting "T00001"?</li>
  <li>How can i count total number of ID when i display with datas in table.</li>
  </ol>
  
  <p>Im a new one in Java MVC GUI. Anyone can help me get a good solution.
  Thanks in advanced</p>
  
  <p>And this is my Data Access Object file.</p>
  
  <blockquote>
    <p>package model;
        import java.sql.*;
        import java.util.ArrayList;
        import javax.swing.JOptionPane;</p>
  </blockquote>
  
  <pre><code>public class SchoolDAO{
      Conexion conexion;
  
      public SchoolDAO(){
  
      conexion = new Conexion();
  }
  
  
          /////INSERT TEACHER
          public String insertTeacher(String tbno, String tbname, String tbphone, String tbqualification, String tbexp){
      String rptaAdd = null; 
  try {
      Connection accessDB  = conexion.getConexion(); 
      CallableStatement cs  = accessDB.prepareCall ("{call teacher_insert(?,?,?,?,?)}");
                    cs.setString(1, tbno);
                    cs.setString(2, tbname);
                    cs.setString(3, tbphone);
                    cs.setString(4, tbqualification);
                    cs.setString(5, tbexp);
  
      int numFAeffect = cs.executeUpdate();
  
              if(numFAeffect&gt;0){
                  rptaAdd ="Add successful.";
              }
      } catch (Exception e){
              JOptionPane.showMessageDialog(null, e.toString());
  }
      return rptaAdd;
  }
  
          public ArrayList&lt;School&gt; listTeacher(){
      ArrayList listaTeacher = new ArrayList();
      School school; 
      try{
      Connection accessDB = conexion.getConexion();
      PreparedStatement ps = accessDB.prepareStatement("select * from teacher");
      ResultSet rs = ps.executeQuery();
      while(rs.next()){
           school = new School();
               school.setTno(rs.getString(1));
               school.setTname(rs.getString(2));
               school.setTphone(rs.getString(3));
               school.setTqualification(rs.getString(4));
               school.setTexp(rs.getString(5));
               listaTeacher.add(school);
  
              }
          }catch (Exception e){
          }
          return listaTeacher;
  
      }
  
  
      }
  </code></pre>