Search code examples
javahibernatejava-ee-6

Is there a "collection-type" equivalent annotation in Hibernate?


In Hibernate you can define a custom collection type by setting the "collection-type" attribute in hibernate xml mapping file.

I was wondering if there is an annotation equivalent.

PS: I tried using @Type but hibernate complains:

"Illegal attempt to map a non collection as a @OneToMany, @ManyToMany" ...

So I assume @Type is just for regular properties.

Thanks!


Solution

  • When this question was made there was no such an annotation. Since HHH-4417 is fixed in version 4.1.1 there is org.hibernate.annotations.CollectionType. Though I don't know does it work with mentioned EventList collection.