The @OneToMany annotation is use for relationships between entities, and I was trying to map a simple collection, not a collection of entities. So I used the @CollectionOfElements annotation from hibernate, and it's working allright now! So now the code look like this:
Thanks for the attention Ali!
posted 13 years ago
Are you sure you want to use a hibernate annotation @CollectionOfElements in your code (I assume you want your code to be JPA compatible so you can change to any other implementation without changing the code)?