Reputation: 1805
I'm trying to make this query work, in my model Workshop I have a enum type field where it connects to roles.
I kinda have never used HQL to do this, only simple HQL queries, I know it's really powerful and simplifies a lot of things but whenever I try to create a query to match the enumerated role it either throws a message about "dereference".
The models corresponding this query is
.
NamedQuery(name="namedOne",
query="from Workshop s inner join Account a where a.account_role = :role"
I have tried this one query which is probably wrong, another one like this
NamedQuery(name="namedOne", query="from Workshop accounts.account_role = :role"
The field accounts contains
@OneToMany(fetch=FetchType.EAGER)
@JoinTable(name="links_ws2accounts")
public List<models.ws.Account> accounts = new ArrayList<models.ws.Account>();
Any suggestion is appreciated, if you need a bit more info let me know
Upvotes: 0
Views: 5080
Reputation: 242686
The question is not very clear, but I guess the query should look like this:
from Workshop s inner join s.accounts a where a.account_role = :role
Upvotes: 1