OK I finally found out what the problem is - I was using java.util.Collection. If I change it to java.util.List - it works. If I change it to java.util.SortedSet I get this exception:
Caused by: org.hibernate.AnnotationException: A sorted collection must define and ordering or sorting : xxxx.ProductModel.galleryImages
at org.hibernate.cfg.annotations.CollectionBinder.applySortingAndOrdering(CollectionBinder.java:597)
at org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:434)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:2123)
The reason I'm using java.util.Collection is that I remember when having two or more properties of type java.util.List I was getting the org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags.
|