[JBoss Seam] - multiple component instances in one page
by soudmaijer
Allright, I might be asking something dumb, but: I have build a simple helloworld application. Below is the component:
| @Name("helloworld")
| public class Helloworld {
|
| private DumbUser dumbUser;
|
| public String sayHello() {
| System.out.println("sayHello");
| return "success";
| }
|
| public DumbUser getDumbUser() {
| System.out.println("retrieving user");
| return dumbUser;
| }
|
| public void setDumbUser(DumbUser dumbUser) {
| System.out.println("setting user");
| this.dumbUser = dumbUser;
| }
| }
|
And this simple class
|
| public class DumbUser {
|
| private String name;
|
| public DumbUser() {
| }
|
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
| }
|
|
This is the JSF page:
| <h:form id="helloworld">
| <div>
| <h:inputText value="#{helloworld.dumbUser.name}"/>
| <h:commandButton type="submit" value="sayHello!" action="#{helloworld.sayHello}"/>
| </div>
| </h:form>
|
|
When I hit the button, the helloworld.sayHello is never triggered. I can`t figure out why. helloworld.getDumbUser is called but then execution stops.
Uhm, what am I doing wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011921#4011921
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011921
19Â years, 2Â months
[EJB 3.0] - Using own Classes as member for ManyToMany-Assotiations
by micho
I defined a class
public class UsergroupList extends ArrayList<Usergroup>
| {}
|
The class user is
public class User implements Serializable
| { ...
| private UsergroupList mUsergroupList;
|
| @ManyToMany ( targetEntity = Usergroup.class )
| public Collection getUsergroupList()
| { return mUsergroupList; }
when deploying I get the error
org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.xyz.UsergroupList
|
but I think UsergroupList implements collection as it is an ArrayList
If I write
@ManyToMany ( targetEntity = Usergroup.class )
| public Collection getBenutzerGruppeListe()
| { return mUsergroupList; }
| the deployment works.
But invoking
private EntityManager em;
| ...
| erg = (List<User>) em.createQuery("from User").getResultList();
|
throws
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of com.xyz.User.usergroupList
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011917#4011917
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011917
19Â years, 2Â months