Can you do a findBy from the "end" bean in a unidirectional relationship?
Give me the "state bean collection" for all states that have a location.
So a Location bean has an Address bean that has a State bean.
In sql it would be "SELECT DISTINCT STATE.STATE_ID WHERE LOCATION.ADDRESS_ID = ADDRESS.ADDRESS_ID AND ADDRESS.STATE_ID = STATE.STATE_ID"
Is this possible in EJB-QL?
you should use "ejbSelect" instead "find" method if you want to make this ejb-ql work.
Sorry,I misunderstood your meaning.
You can use "astract-schema-name" which you defined in your ejb-jar.xml for each cmp bean, to make your query.
The problem is that it is on the wrong end of the unidirectional relationship.
The "State Entity" does not know about the address/location.
Is there a way to get a state collection relating back up the chain?
SELECT DISTINCT OBJECT(loc.address.state)
FROM Location loc
This finds all the locations, and get's the state associated with the address associated with the location.