@Override
    public void insertSupplier(SupplierEntity entity) throws SupplierException {
        try {
            PrimaryIdGenerator pig = new PrimaryIdGenerator();
            pig.setFormat("date");
            pig.setPrefix("SUP");
            pig.setReferences("supplier", "supplier_id");
            String id = pig.generateId();

            String query;
            query = "INSERT INTO "
                    + "supplier( "
                    + "supplier_id, "
                    + "supplier_name, "
                    + "supplier_address, "
                    + "supplier_phone, "
                    + "supplier_email, "
                    + "supplier_lastmodif) "
                    + "VALUES( "
                    + id
                    + ",?,?,?,?,NOW()); ";

            conn = getConnection();
            conn.setAutoCommit(false);
            sth = conn.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
            sth.setString(1, entity.getSupplier_name());
            sth.setString(2, entity.getSupplier_address());
            sth.setString(3, entity.getSupplier_phone());
            sth.setString(4, entity.getSupplier_email());
            sth.executeUpdate();
            conn.commit();
        } catch (SQLException e) {
            try {
                conn.rollback();
            } catch (SQLException ex) {
            }
            throw new SupplierException(e.getMessage());
        } finally {
            try {
                if (sth != null) {
                    sth.close();
                }
                if (conn != null) {
                    conn.setAutoCommit(false);
                    conn.close();
                }
            } catch (SQLException e) {
            } catch (Exception e) {
            }
        }
    }