I have this model:
@Entity
@History
class Title (
var description: String,
var ownerName: String
): Model()
{
@Id
@GeneratedValue
val id: Long = 0
override fun toString(): String {
return "Title(description='$description', ownerName='$ownerName', id=$id)"
}
}
Then I try this in the controller:
@GetMapping("/{id}")
fun getTitle(@PathVariable id: Long): ResponseEntity<List<Version<Title>>> {
val end = Timestamp.valueOf("2022-07-25 16:10:44")
val start = Timestamp.valueOf("2017-02-03 10:37:30")
val titleList = DB.find(Title::class.
java)
.where()
.eq("id", id)
.findVersionsBetween(start, end)
return ResponseEntity.ok().body(titleList)
}
This creates an infinite loop, running the query over and over again until I quit. It appears that returning multiple versions with the same ID creates a problem when it tries to hydrate those versions.
Anyone have any idea what I'm doing wrong? This is with Kotlin and Spring Boot.
TIA,
Chas.