Is it possible to tell hibernate to use LinkedHashSet as a underlying set for PersistentSet without OrderBy annotation

Hi, I am ordering one to many relation with querydsl cause i don’t want to use order by default, only when its needed. So the problim is - because the hibernate uses hash set for underlying set of PersistentSet order is not saved after fetch from repository even there is order by clause in generated sql. So is there any solution to tell hibernate to use LinkedHashSet for PersistentSet without using @OrderBy annotation cause with @Orderby order is deafult when fetching parent entity?

You can use a custom UserCollectionType implementation, and then annotate your collection as @CollectionType( type = MyUserCollectionType.class ). You can also use the the @CollectionTypeRegistration to register the type easily and always use it when mapping attributes of a certain collection interface / class.