Quarkus + Kotlin + Hibernate Reactive + Panache: Accessing @OneToMany properties in companion class #41490
Unanswered
alecStewart1
asked this question in
Q&A
Replies: 2 comments
-
/cc @DavideD (hibernate-reactive), @FroMage (panache), @gavinking (hibernate-reactive), @geoand (kotlin), @loicmathieu (panache) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, apologies. The question still stands, however I forgot that this should be done with an ID parameter for a County. That's also useful for when I get to caching the results of these functions. // The companion object function I'm struggling with would be more like the following
fun getBuildingsInCounty(id: Long): Uni<Set<Building>> {
val baseList: Uni<List<Building>> = list("select cnty.buildings from County cnty where cnty.id = :id", Parameters.with("id", id).map())
return CollectionConverts.uniListToSet(baseList)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, so maybe this is just a "I have read the docs" thing, but, as example, I have the following entity classes that I'll be using the the active record style:
(As of note, I'm still fairly new to Kotlin.)
Singular building entity that belongs to a county:
The entity class that will have many buildings to one county.
The commented out function in the companion class is where I'm having issues.
The utility class
CollectionConverts
, if anyone needs to see it:I guess my confusion is related to
PanacheQuery
, it's functions and how it interacts with Hibernate entities, or maybe it's really just something I didn't read about companion objects in Kotlin. I have worked with Hibernate and HQL before, so that's not entirely new to me.Beta Was this translation helpful? Give feedback.
All reactions