Q:

jTable sorts everything as String

I download data from MySQL (JDBC) database and display it in jTable:
PreparedStatement pstmt = (PreparedStatement) connection.prepareStatement(query); 
pstmt.setInt(1,idUser);
result = pstmt.executeQuery();

jTable.setModel(DbUtils.resultSetToTableModel(result));

I use Netbeans, on the jTable in properties I set autoCreateRowSorter option to true.  Sorting works, however, some of the columns should be sorted as int value, but e.g. user ID is sorted as String.   I don't know how to initialize a table in a way that allows me to choose a column type.  Then sorting should work properly.  Probably it can be done in this line of code (below) that's why I'm asking for advice from someone more experienced. 
jTable.setModel(DbUtils.resultSetToTableModel(result)); 

I can also add how the columns in my table look like:
UserID(int) / name(String) / surname(String) / phone number(int) / 
dateTime(e.g.  2018-11-03 19:02:45 - may remain in the programme as String)

A:

You need to override the getColumnClass(...) of the JTable to tell the table what type of data is in each column so the table can use the appropriate render/editor and Compartor for each column. 
Something like:
@Override
public Class getColumnClass(int column)
{
    for (int row = 0; row < getRowCount(); row++)
    {
        Object o = getValueAt(row, column);

        if (o ! = null)
        {
            return o.getClass();
        }
    }

    return Object.class;
}

