OGM fails to map certain types in Kotlin data class

I noticed that my String @Properties were mapping fine, but not a FloatArray. In fact, only first two strings get mapped – even if the third property is a String, it isn't mapped. However, this object also contains a FloatArray, so I suspect that once the enumeration gets tripped up, it gives up entirely.

The root of the problem seems to start way down in how Java enumerates annotations with getDeclaredAnnotations. Here's a simple class that exhibits the problem:

data class Point(@Id @GeneratedValue(strategy = UuidStrategy::class) val uuid: String? = null,
                 @Property(name = "name") val name: String? = null,
                 @Property(name = "vector") val vector: FloatArray? = null

uuid and name get properly mapped, vector is always null. If I instead define Point as a java class, everything works as expected. I also tried replacing FloatArray with java.util.List<java.lang.Float>, to no avail. Any ideas?

Thanks in advance, ya'll!

Derp, this was due to inadvertently declaring some as val versus var, and not an issue with K-types.


If you're using OGM with SDN, you can keep your standard attributes final and construct stuff via constructor with SDN 5.1 (Lovelace) and OGM 3.1.x. Not supported for relationships (collection attributes).

Does the same apply when you use OGM 3.1.x without SDN?

The constructor support only exists in Spring Data Neo4j right now.

That's a shame. Are there any plans for porting this functionality to OGM itself? If so, is there an issue/ticket where I can keep track of the progress?