I have a ManyToOne from entity A to entity B on a non primary unique key. If I annotation the association with @LazyToOne and use build time instrumentation, I can get it to be loaded lazily. The problem I'm having is if I create a criteria query that does a join for this assoication, whenever I go to access entity B (the one), hibernate is issuing a sequential select on entity A for the join column to entity B, even though entity B was loaded via the join. If I don't do the join, hibernate will do this same sequential select and then select entity B, which is what is expected in this case, even though I am unsure as to why hibernate is doing another query on entity A, since it is already loaded in the session. Both of these occurences seem like a bug. Maybe this is a bug in the enhanced class?
|