chubbard wrote:
I hadn't thought about that. That's pretty creative. I'm not positive that would work since my view wants the devices displayed along with their NICs and DNS. I can see if it works or not.
So is this to say I can't do this type of deep query joins? I am just curious if it's possible. This has got to be a common thing as you said with large hierarchies. It would only make sense that Hibernate/EJB provide assistance in this matter. You can do it with SQL pretty easy at least.
Charlie
I'm pretty sure (though I haven't read to confirm) that the JPA spec doesn't support joins at that level, though Hibernate *can* handle it, it only seems to work if you're not chaining out through a collection.
Again, don't take my word for it...I'm just recalling from memory...I could be wrong.
I know this query works for me but I'm joining 2 levels deeper through single entities:
Code:
String query = "select otd from OrderTrafficDetail otd " +
"left join fetch otd.orderTraffic " +
"left join fetch otd.customerOrder " +
"left join fetch otd.customerOrder.deliveryRegion " + //bingo!
"left join fetch otd.orderTraffic.vendor " +
"where otd.orderTraffic.shipDate = :shipDate " +
"order by otd.orderTraffic.carrierNo";
Anyhow, w/ some fenagling (sp?) you should be able to just approach the model from the middle and get the same data....I do the same trick when I want the app to perform a little better.