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