Copy the needed relation-property to your entity. Mark as readonly with insertable = false, updatable = false.
@ManyToOne @JoinColumn(name = "column_name", insertable = false, updatable = false) private EntityX entityX;
now you can directly create the alias instead of using the composite id property.
criteria.createCriteria("entity.entityX", "entityX")
Copy the needed relation-property to your entity. Mark as readonly with insertable = false, updatable = false.
now you can directly create the alias instead of using the composite id property.