This content has been marked as final.
Show 3 replies
-
1. Re: Injection Problem
fernando_jmt Apr 25, 2007 1:48 PM (in response to petedog)@Entity @Name("contact") @Role(name="contact1") @Table(name = "CONTACT") public class Contact implements java.io.Serializable { private Long id; private String firstName; ...... }
@Stateful @Scope(SESSION) @Name("customerFormAction") public class CustomerFormAction implements ICustomerFormAction, Serializable { private static final long serialVersionUID = 1L; @Logger private Log log; @In Contact contact; @In Contact contact1; ........ }
............... Contact 1 First: <h:inputText value="#{contact.firstName}"/> Contact 1 Last: <h:inputText value="#{contact.lastName}"/> Contact 2 First:<h:inputText value="#{contact1.firstName}"/> Contact 2 First:<h:inputText value="#{contact1.lastName}"/> ...........
-
2. Re: Injection Problem
sjmenden Apr 25, 2007 1:54 PM (in response to petedog)What does contact1 and contact2 refer to? Without seeing the rest of your code it looks like you need to set up roles for the entity:
@Entity @Name("contact") @Table(name = "CONTACT") @Roles( { @Role(name="contact1", scope=EVENT) @Role(name="contact2", scope=EVENT)} ) public class Contact { ... }
Alternatively, the method I prefer, you could create a ContactHome which extends EntityHome where you could hold references to Contact contact1, Contact contact2 with the getters and setters. then reference in the form through contactHome.contact1.firstname ect... -
3. Re: Injection Problem
petedog Apr 25, 2007 2:07 PM (in response to petedog)Thanks! By adding the @Roles/@Role annotation to the entity it now works.
/P