Last active
September 14, 2019 01:17
-
-
Save mtrojahn/65b5bfcf7e26895edbef7c6113a7b3e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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