I'm working on a pet project with Kotlin and Spring Data Neo4j (I'll add support for Neo4j in KotlinPrimavera for upcoming releases)
So, I create a data class with some annotations
[NodeEntity]
data class User(
[Indexed]
[GraphProperty]
var userId: String,
[GraphId]
var nodeId: Long = 0,
var name: String,
[RelatedTo(type
= “IS_FRIEND_OF”, direction = Direction.BOTH, elementClass=javaClass<User>())]
var friends: Set<User>? = null,
[RelatedToVia(type
= “HAS_SEEN”, elementClass=javaClass<Viewing>())]
var views: Set<Viewing>? = null,
var referredBy: User? = null)
When I try to save an instance of this class, Spring Neo4j show me this error
Exception in thread “main” org.springframework.data.mapping.model.MappingException: The type of the id-property in long nodeId rel: false idx: false must not be a primitive type but an object type like java.lang.Long
Seems that Kotlin compiler convert the jet.Long in a primitive long.
There is a way to override this behaviour? Using java.lang.Long explicitly don’t work