@PostConstruct private void setupSuggestions() { MultiWordSuggestOracle iso = (MultiWordSuggestOracle) name.getSuggestOracle(); for (Item i : em.createNamedQuery("allItemsByName", Item.class).getResultList()) { iso.add(i.getName()); } MultiWordSuggestOracle dso = (MultiWordSuggestOracle) department.getSuggestOracle(); for (Department d : em.createNamedQuery("allDepartments", Department.class).getResultList()) { dso.add(d.getName()); } }
@SuppressWarnings("unused") private void onNewItem(@Observes Item newItem) { System.out.println("ItemForm@" + System.identityHashCode(this) + " got new item event"); ((MultiWordSuggestOracle) name.getSuggestOracle()).add(newItem.getName()); }