Skip to content

Instantly share code, notes, and snippets.

@piercelamb
Created August 17, 2016 17:08
Show Gist options
  • Save piercelamb/aa4443834997633ff7c24cbff9022fd0 to your computer and use it in GitHub Desktop.
Save piercelamb/aa4443834997633ff7c24cbff9022fd0 to your computer and use it in GitHub Desktop.
def addNewAccount(email: String, password: String, firstName: String, role: Role)(implicit s: DBSession = auto) {
val id = withSQL {
val pass = BCrypt.hashpw(password, BCrypt.gensalt())
QueryDSL.insert.into(Account).namedValues(
ac.email -> email,
ac.password -> pass,
ac.name -> firstName,
ac.role -> role.toString()
)
}.updateAndReturnGeneratedKey.apply()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment