Hi All,
I am trying to persiste an Entity (JPA with Hibernate) with a List<String>.
I can't use the OneToMany association because String is not an Entity.
So I use the @CollectionOfElements annotation, but it's not seen as a OneToMany assocation :
When I fetch the element, I have N instance of DataSet, where N is the number of element of
listOfString
The entity:
Code:
@Entity
public class DataSet {
...
@CollectionOfElements(fetch=FetchType.EAGER)
@IndexColumn(name="listOfString")
[b]private List<String> listOfString[/b];
..
}
The fetching code:
Code:
em.createQuery("SELECT d FROM DataSet d");
I read this post, saying that "HQL queries are not affected by the fetching strategy at all."
http://forum.hibernate.org/viewtopic.php?t=971700&highlight=onetomany+collectionofelements
But it's not my case, with EAGER, my list is loaded, but I have N instance of DataSet, where N is the number of element of
listOfString
Can anyone help me please ?
Regards,
Samuel