Was able to pin point the issue.
This is caused by the inclusion of the fieldname of the associated entity itself in the projection. For example,
UserAccount userAccount is an associated entity within Cargo entity. Using Hibernate classmetadata, I have included all property fields, which also includes userAccount field in the projection such as Projection.property("userAccount"). This caused hibernate to substitute this column with the root entity identifier field with a duplicate sql alias relative to the next column in the projection list.
Though the primary root cause has been fixed in my end, but I think hibernate just should just throw an exception if the client code is including the associated entity field in the projection.
|