Hi!
I have an object model with a Unit having a one-to-one relation to a UnitIdentifier. In the database, all fields of both classes are contained within a single table.
It's easy enough to simply map those classes like usual and call it a day, but this will result in two queries to the database: select the fields of Unit in the correct row, and then select the fields of UnitIdentifier in the same row.
This is fine, I guess, but it makes me hurt a bit inside
Is there a way to do this using a single fetch?
EclipseLink has a @JoinFetch annotation you can used on a relationship, or you can use fetch join in JPQL for particular relationships. What is the table and entity setup for these two classes? Do they share a row, are they using inheritance, etc?
Thanks for the reply, Chris, but @JoinFetch was not quite what I was after. However, I found that @Embeddable/@Embedded does exactly what I want.
Problem solved.
/Matti