Tag: spring jpa

kotlin中的数字是不可序列化的

我发现kotlin中的数字是不可序列化的。 第一个问题 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 { public fun findByName(Param(“name”) name: String): List […]

KOTLIN orphanRemoval无效

是否有任何人删除子记录的类似问题,但没有使用orphanRemoval注释? 以下是我在Model Class构造函数中的代码示例: @OneToMany(orphanRemoval = true, cascade = arrayOf(CascadeType.ALL)) @JoinColumn(name = "categoryId", nullable = false) var books: List<BOOK> = emptyList() 使用cascade = arrayOf(CascadeType.ALL)的CRUD是完美的工作,但是当在“ONE-TO-MANY”注释中添加orphanRemoval = true时,它不能再工作,抛出如下异常: org.hibernate.HibernateException:具有cascade =“all-delete-orphan”的集合不再由拥有的实体实例引用: 添加orphanRemoval从数据库中永久删除子记录的目的。

kotlin中的数字是不可序列化的

我发现kotlin中的数字是不可序列化的。 第一个问题 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): […]