If you are using Annotation, do as follows (Use List instead of Array)
@Entity
public class User {
private List<String> itemList = new ArrayList<String>();
@CollectionOfElements
@JoinTable(name="TABLE_ITEM")
private List<String> getItemList() {
return this.itemList;
}
}
And do as follows
User user = (User) sessionFactory.openSession().get(User.class, userId);
user.getItemList().add(item);
Because you have a managed Entity instance (User) and the lifecycle of a value-type instance (your String list) is bound to that of its owning entity instance (User). Hibernate will save your new item.