Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EclipseLink alias naming and ordering

To be clear, I am surprised the following query does not work for case related reasons:

>> SELECT dePartment
>>  From Department dePartment
>> LEFT JOIN FETCH dePartment.employees
>> LEFT JOIN dePartment.employees emps

JPQL, however is case sensitive in a number of ways

1. In the above query Department must match the Entity name (case sensitive)
2. In the above query the alias FROM clause, "From Department dePartment" must be used with identical case in other parts of the query 3. The attributes must match the attribute names defined in the entity. i.e. "dePartment.employees" will make a case sensitive match to the attribute "employees" on the Department object.



Tom Ware wrote:
I am surprised you are getting an issue with #1 below, please file a bug and include a recreation.

For your other issue, have a look at the following bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=303767

-Tom

janardhan n wrote:
I am having a strange problem with EclipseLink
For an Entity having collection
class Department {
List<Employee> employees;
List<Section> sections;
}

1. If I use the below query
SELECT dePartment
 From Department dePartment
LEFT JOIN FETCH dePartment.employees
LEFT JOIN dePartment.employees emps
   It is fetching only dePartment entities without the collection.
If I use alias name as department instead of dePartment(observe the case of letter P)
   Is the alias name case sensitive? sounds silly

2. If I use the below query
SELECT dePartment
 From Department dePartment
LEFT JOIN FETCH dePartment.employees
LEFT JOIN dePartment.employees emps
LEFT JOIN FETCH dePartment.sections
LEFT JOIN dePartment.sections sects
   Then it is fetching only first child collection.

   If I change the join order like below,
SELECT dePartment
 From Department dePartment
LEFT JOIN FETCH dePartment.employees
LEFT JOIN FETCH dePartment.sections
LEFT JOIN dePartment.employees emps
LEFT JOIN dePartment.sections sects
   Then it is fetching both the child collections.

   Is the order of join columns matter in EclipseLink?

3. Are the above said things are specific to EclipseLink or JPA Conventions?



------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top