Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-19-2018 07:06 AM
While it was a bit extra work getting Kotlin to work smoothly with SDN & OGM, with help from this awesome community I was able to get it working happily. Emboldened by that success, I was going to attempt to convert a stored procedure to Kotlin, but I'm running into an issue with getting the GraphDatabaseService
injected into a procedure class. Code:
open class OrderedConnect /*constructor(@Context var db: GraphDatabaseService? = null,
@Context var log: Log? = null)*/ {
@Context
open var db: GraphDatabaseService? = null
...
If I try it with the commented-out constructor version, the exception is "kotlin.jvm.internal.DefaultConstructorMarker". The other way, exception is "Field db
on OrderedConnect
must be non-final and public." I'm not sure how to make those much more non-final and public, but being a master of neither JVM nor Kotlin I was hoping a solution might jump out to someone.
Thanks in advance!
Solved! Go to Solution.
11-19-2018 07:47 AM
FYI, I don't know Kotlin, but based on the graphql
plugin (https://github.com/neo4j-contrib/neo4j-graphql) you should try this :
@Context
@JvmField var db: GraphDatabaseService? = null
Hope it can helps, otherwise take a look at the code's plugin or wait for a Kotlin master 🙂
11-19-2018 07:47 AM
FYI, I don't know Kotlin, but based on the graphql
plugin (https://github.com/neo4j-contrib/neo4j-graphql) you should try this :
@Context
@JvmField var db: GraphDatabaseService? = null
Hope it can helps, otherwise take a look at the code's plugin or wait for a Kotlin master 🙂
11-19-2018 07:53 AM
Thank you @Benoit! I'd tried that briefly, but discarded as it can only be applied to final
and that seemed the opposite direction to go, but it turns out that's the solution! I hadn't found any Kotlin procedures in the wild, so that link is super helpful! (Although note it's missing the final "l")
All the sessions of the conference are now available online