Skip to content

Instantly share code, notes, and snippets.

@mtrojahn
Last active Sep 14, 2019
Embed
What would you like to do?
@Entity
class Script(
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
var id: Long? = null,
var name: String = "",
var source: String = "",
var description: String = "",
@Version
var version: Long = 0L,
) {
companion object : Finder<Long, Script>(Script::class.java)
}
fun someExamples() {
// lists all scripts
val list = Script.all()
// find a single script by it's name
val script1 = Script.query().where().eq("name", "name of the script").findOne()
// finds the script with id = 1
val script2 = Script.byId(1)
// delete the script with id = 1
Script.deleteById(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment