I found that the numbers in kotlin are not serializable.
Device.kt:
package test.domain import javax.persistence.* Entity public class Device { public Id GeneratedValue var id: Long = -1 public var name: String = "" ... }
DeviceRestRepository.kt:
package test.domain import org.springframework.data.repository.PagingAndSortingRepository import org.springframework.data.repository.query.Param import org.springframework.data.rest.core.annotation.RepositoryRestResource RepositoryRestResource(collectionResourceRel = "device", path = "device") public trait DeviceRestRepository : PagingAndSortingRepository<Device, Long?> { public fun findByName(Param("name") name: String): List<Device> }
I get an error when trying to compile this code because kotlin.Long is not Serializable :
Error: (14, 72) Kotlin: the type argument is not within its borders: should it be a subtype of "java.io.Serializable?"
- Second problem
I get the same error when I try to use java.lang.Long :
DeviceRestRepository.kt:
package test.domain import org.springframework.data.repository.PagingAndSortingRepository import org.springframework.data.repository.query.Param import org.springframework.data.rest.core.annotation.RepositoryRestResource RepositoryRestResource(collectionResourceRel = "device", path = "device") public trait DeviceRestRepository : PagingAndSortingRepository<Device, java.lang.Long?> { public fun findByName(Param("name") name: String): List<Device> }
Warning: (14, 72) Kotlin: This class should not be used in Kotlin. use kotlin.Long instead.
Error: (14, 72) Kotlin: the type argument is not within its borders: should there be a subtype of "java.io.Serializable?"
source share