Reputation: 299
The question is quite mouthful , it can be simply described by the following query:
select c.name,c.brands FROM ShopChannels c
ShopChannel is the basic entity which has a collection of brands which is of on-to-many,instead select all the brand properties in this query ,I only want to select partial fields of Brand, if I use
select c.name,c.brands.spell from ShopChannels c
I'll get a "cannot navigate collection valued association field " error message.
This kind of query can greatly boost performance, so anyone has an idea?
Upvotes: 0
Views: 1781
Reputation: 4211
The JPA specification says that "´It is syntactically illegal to compose a path expression from a path expression that evaluates to a collection.´" A solution to your need is a join query like: ´select c.name,b.spell from ShopChannels c inner join c.brands b´.
Upvotes: 2