|
See
HHH-4417
and HCANN-65
Hibernate allows custom collection types using @CollectionType, but it is not currently possible to use the custom type in the declaration. An existing test case (org.hibernate.test.collection.custom.basic.User) illustrates this:
@OneToMany( fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true ) @CollectionType( type = "org.hibernate.test.collection.custom.basic.MyListType" ) @JoinColumn( name = "userName" ) @OrderColumn( name = "displayOrder" ) public List<Email> getEmailAddresses() { // does not work  // public IMyList<Email> getEmailAddresses()
Unknown macro: { return emailAddresses; }
HCANN-65 currently limits ORM's ability to do this, but even with that resolved, this JIRA is to setup the proper bindings. The most straightforward way is to see which interface the declared interface extends from. In the example above, IMyList extends List so it should use List semantics when binding.
When the type can't be inferred (for example, if the custom interface supports multiple, but a specific binding is desired), the semantics class can be defined on the @CollectionType annotation.
|