Silvana Donato

Greenhorn
+ Follow
since Nov 13, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Silvana Donato

I think that this means that you are trying to get a collection that has not actually been retrieved by the db yet.
You can try to set fetch property to fetchtype.eager in the annotation of the collection property.
Something like:

@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)


@JoinTable(name = "VENDOR_EMAILS",
joinColumns = {
@JoinColumn(name="VENDOR_ID", unique = true)
},
inverseJoinColumns = {
@JoinColumn(name="VENDOR_ID")
}



I think that joinColumns and inverseJoinColumns refer to the same table VENDOR_EMAILS, so you are creating 2 columns with the same name.
The inverseJoinColumns could be emails_id

An important point I'd like to point out for the future generations is that the selectOneMenu need to be fed up by an array of SelectItem and not a List as I tried and failed with

Something like this:

public SelectItem[] getAClassInstances() {
SelectItem[] selectItems;
//querying the db with hibernate query
Session sess = HibernateUtil.getSessionFactory().openSession();
Query query = sess.createQuery("from AClass");
selectItems = new SelectItem[query.list().size()];
int ii=0;
for(Iterator it=query.iterate();it.hasNext();){
AClassap = (AClass)it.next();
SelectItem item = new SelectItem(ap,
ap.getDescription(),
ap.getDescription());
selectItems[ii]=item;
ii++;
}
return selectItems;
}
14 years ago
JSF