[JBoss Seam] - Stateless Converter: First works, then ClassNotFoundExceptio
by bfo81
I have an entity Person that has a ManyToMany relation to other Persons ("friends" ;)). When editing one person there's a SelectManyMenu showing all Persons and you can select or deselect friends.
The SelectManyMenu has a Converter (... converter="#{personConverter}"), of course. This one is implemented as a Stateless Session Bean with @Name("personConverter") and the two methods getAsString(...) and getAsObject(...).
The persons are filled into that List by <f:selectItems value="#{personListe.selectItems}" />. You guess it, the selectItems() method returns a List, which's items are all added like this: ...add(new SelectItem(aPerson.getId(), aPerson.getName()));
So far so good. Should be nothing special here ;).
When going to the edit page everything works fine, and the Log shows me that the getAsString-method is called for every Person in the list.
BUT: As soon as a safe the edited person (and it doesn't play a role whether I select friends or not) there's an Exception:
FATAL [org.apache.myfaces.renderkit.html.HtmlRepsonseStateManager] Cannot decode Object from Base64 String
| java.lang.ClassNotFoundException: No ClassLoaders found for: de.beffo.test.converter.PersonConverter
| at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
| at ...
Well... how can it be that the Converter is found when the page is displayed, and not found right after submitting? Anyone having experience with such a behaviour?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960961#3960961
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960961
19 years, 9 months
[JBoss Seam] - Re: More seam examples
by petemuir
| Parent parent = new Parent();
| Child child = new Child();
| Car car = new Car();
| parent.setCar(car);
| parent.add(child);
| parent.persist(parent);
|
Assuming car and child are entities with no references to parent and Parent is:
| @Entity
| public class Parent {
|
| @ManyToOne(cascade=PERSIST)
| private Car car;
| @OneToMany(cascade=PERSIST)
| private List<Child> children;
|
| ...
| // Getters and setters
| }
|
If you had bi-directional relationships you might want
| entityManager.flush();
| entityManager.refresh(parent);
|
as well.
Nullifying view objects should work fine (empty fields) (but you need to make sure the new version is outjected which requires a reasonable understanding of the difference between variables in the component and context variables).
Regarding relationships - this is really a Hibernate/EJB3 JPA issue. The hibernate unit tests are good for understanding the sematics involved.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960960#3960960
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960960
19 years, 9 months