Attempting a criteria query for member routeCreatorId with a value of 1L (whether the row exists in the table or not) I get the following exception.
Invalid path: 'generatedAlias1.routeCreatorId' [select generatedAlias0 from com.linovation.trainapp.database.entities.Route as generatedAlias0 where generatedAlias1.routeCreatorId=1L]
Tracing the Hibernate code into CriteriaCompiler.generateAlias(), the generated alias is incremented when it shouldn't be. The rest of the query construction seems fine until it gets to the where clause. If I set a breakpoint & force aliasCount to be zero before the assignment, the query is created properly, as follows.
select generatedAlias0 from com.linovation.trainapp.database.entities.Route as generatedAlias0 where generatedAlias0.routeCreatorId=1L
select route0_.ROUTE_ID as ROUTE_ID1_4_, route0_.LAST_UPDATED as LAST_UPD2_4_, route0_.DESCRIPTION as DESCRIPT3_4_, route0_.GUID as GUID4_4_, route0_.ROUTE_CREATOR_ID as ROUTE_CR5_4_, route0_.ROUTE_NAME as ROUTE_NA6_4_ from Route route0_ where route0_.ROUTE_CREATOR_ID=2
Is this a defect in your code, or am I doing something wrong? Either way, how does this get fixed?
hibernate-core 4.3.10 Final
hibernate-entitymanager 4.3.10 Final
Any updates on this?
Environment shows hibernate-core 4.3.10 Final and hibernate-entitymanager 4.3.1 Final. Are you really using different versions for hibernate-core and hibernate-entitymanager? I suspect hibernate-entitymanager 4.3.1 Final is a typo and the version is really 4.3.10 Final.
It was indeed a typo, from my pom.xml
This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.
For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.