I tried query.setCacheable(false); in my dao but no change. But also when I try to add the second record, I get a: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: What confuses me, It works with an other entity which is implemented the same way.
2010/2/17 Jakob Korherr <jakob.korh...@gmail.com> > Hi, > > It seems to me like a hibernate problem. Are you sure your entitiy is saved > in your database? Are you refreshing the entities from the database each > time you call getEntities()? > > Regards, > Jakob > > 2010/2/17 baeschtu baeschtu <baesc...@gmail.com> > > > I have two myfaces pages with a backing bean each. > > Both of them have a spring service injected to get access to the > hibernate > > dao's. > > They are related 1-N > > > > So I have a <f:selectItems> combobox in one of them served by a method > like > > this in the backinbean. > > > > private List<Entity> entities; > > .. > > public UISelectItems getEntityList() { > > entityList = new UISelectItems(); > > entities = getEntities(); > > Object[] values = new Object[entities.size()]; > > int count = 0; > > for (Entity e : entities) { > > values[count] = new SelectItem(e.getId(), e.getName()); > > count++; > > } > > entityList.setValue(values); > > return entityList; > > } > > > > > > So the problem is, when I add an Entity on the other page and return to > the > > page with the combobox. The newly added Entity does not show up in the > > combobox. So I assume I get a cached version from the backing bean or the > > items are still cached in the viewState. > > > > thanks > > Bastian > > >