Fix currentTransaction in references while using query

This commit is contained in:
2024-05-06 20:50:29 +02:00
parent 68562160f1
commit 7eda90d30d
10 changed files with 136 additions and 133 deletions

View File

@@ -7,52 +7,14 @@ import nl.astraeus.nl.astraeus.persistence.TransactionLog
import nl.astraeus.nl.astraeus.persistence.count
import nl.astraeus.nl.astraeus.persistence.index
import nl.astraeus.nl.astraeus.persistence.searchIndex
import nl.astraeus.persistence.domain.Company
import nl.astraeus.persistence.domain.Person
import java.io.File
import kotlin.random.Random
import kotlin.test.Test
class TestThreaded {
class Company(
override var id: Long = 0,
override var version: Long = 0,
val name: String,
val adres: String = "Blaat"
) : Persistable, Cloneable {
//var persons: MutableList<Person> by ListReference<Person, Company>(Person::class.java)
companion object {
private const val serialVersionUID: Long = 1L
}
override fun toString(): String {
return "Company(id=$id, version=$version, name='$name', adres='$adres')"
}
}
class Person(
override var id: Long = 0,
override var version: Long = 0,
val name: String,
val age: Int,
var companyId: Long? = null
) : Persistable, Cloneable {
/* var company: Company? by Reference(
Company::class.java,
{ id -> companyId = id },
{ companyId }
)*/
companion object {
private const val serialVersionUID: Long = 1L
}
override fun toString(): String {
return "Person(id=$id, version=$version, name='$name', age=$age)"
}
}
@Test
fun showTransactions() {
val log = TransactionLog(File("data", "test-threaded"))