Hi Everyone,
Being new to
EJB QL, I'm unable to figure this out. Please help. I'll provide a simplified scenario.
You have a customer table with columns: name, state. state is a lookup/fk value like 11,12 where the full description comes from another table STATE having colms state_id, state_desc.
How do I write this query in EJB3 QL so that I get back the customer name and state description?
I don't prefer doing a join like:
Select c.name, s.desc from customer c, state s where c.state=s.state_id. I think thats easy to figure out in EJB QL.
The reason I don't want this is that I could have 10 other lookup columns in my customer table and I don't want to go on doing joins. (Actually in my case I have one lookup table to store all lookup values so it makes it complicated!!).
I'd prefer an equivalent of something like this:
Select c.name, (Select s.desc from state s where s.state_id=c.state) from customer c.
I'm not sure how to do this.
Please suggest and guide.. Tks!