Code example for PreparedStatement

Methods: setLongsetString

	this.user = user;
    protected void fillParameters(PreparedStatement stmnt) throws SQLException {
	stmnt.setLong(1, user.getId());
	stmnt.setString(2, user.getUsername());
	stmnt.setString(3, user.getName());
	stmnt.setString(4, user.getEmail());
	stmnt.setString(5, user.getPhone());
	stmnt.setString(6, user.getPassword());
	stmnt.setLong(7, user.getRole().getId());
    protected String getSQL() {
	return "INSERT INTO Users( id, username, name, email, phone, password, roleid) VALUES (?,?,?,?,?,?,?)"; 
Connect your IDE to all the code out there  Get Codota for Java