if (this.alias==null) {
// Only set the realm user's alias if the alias is not null
if (alias!=null) {
DBConnection connection = db.getConnection();
try {
connection.update(AuthDB.CREATE_REALM_USER_ALIAS, new DBUpdateHandler() {
public void prepare(PreparedStatement s)
throws SQLException
{
s.setInt(1,id);
s.setString(2,alias);
s.setString(3,id+"-"+alias);
}
});
} finally {
db.release(connection);
}
}
} else {
if (alias!=null) {
// just update
DBConnection connection = db.getConnection();
try {
connection.update(AuthDB.UPDATE_REALM_USER_ALIAS, new DBUpdateHandler() {
public void prepare(PreparedStatement s)
throws SQLException
{
s.setString(1,alias);
s.setString(2,id+"-"+alias);