This content has been marked as final.
Show 6 replies
-
1. Re: help with EntityList
thejavafreak Oct 31, 2007 1:25 AM (in response to terryb)Show us the entity class here.
-
2. Re: help with EntityList
terryb Oct 31, 2007 2:00 AM (in response to terryb)cut down version of entities involved. I guess I am not sure how to build ejb
for my case and how to use it in restrictions and eventually how to access it in jsf@Entity @Table(name = "Client") public class Client implements java.io.Serializable { private String id; private String username; private Set<Contact> contacts = new HashSet<Contact>(0); private Set<Applicant> applicants = new HashSet<Applicant>(0); public Client() { } ..... @Id @Column(name = "ID", unique = true, nullable = false, length = 20) @NotNull @Length(max = 20) public String getId() { return this.id; } public void setId(String id) { this.id = id; } @Column(name = "Username", length = 20) @Length(max = 20) public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "client") public Set<Contact> getContacts() { return this.contacts; } public void setContacts(Set<Contact> contacts) { this.contacts = contacts; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "client") public Set<Applicant> getApplicants() { return this.applicants; } public void setApplicants(Set<Applicant> applicants) { this.applicants = applicants; } } @Entity @Table(name = "Contact") public class Contact implements java.io.Serializable { private String id; private Client client; private String surname; private Set<Address> addresses = new HashSet<Address>(0); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ClientID") public Client getClient() { return this.client; } public void setClient(Client client) { this.client = client; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "contact") public Set<Address> getAddresses() { return this.addresses; } public void setAddresses(Set<Address> addresses) { this.addresses = addresses; } } @Entity @Table(name = "Address") public class Address implements java.io.Serializable { private String id; private Contact contact; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ContactID") public Contact getContact() { return this.contact; } public void setContact(Contact contact) { this.contact = contact; } } JSF ... <h:dataTable id="clientList" var="client" value="#{clientList.resultList}" rendered="#{not empty clientList.resultList}" border="1"> <h:column> #{client....????} </h:column> ...
-
3. Re: help with EntityList
thejavafreak Oct 31, 2007 4:43 AM (in response to terryb)Why does your Client and Contact entity does not have any Id?
-
4. Re: help with EntityList
terryb Oct 31, 2007 5:04 AM (in response to terryb)Hi Joshua, all entities have Id field - I removed extra code to make it less verbose. sorry it caused confusion.
-
5. Re: help with EntityList
pmuir Oct 31, 2007 5:53 AM (in response to terryb)This question is about how to formulate the ejbql? You'll need to ask that on the hibernate jpa forum.
-
6. Re: help with EntityList
terryb Oct 31, 2007 8:58 AM (in response to terryb)Pete, ejbql formulation is part of it. I am seeking help on how to use a Set of entities (returned in select clause) with seam-gen generated MyEntityList restrictions mechanism; and to use then in h:databTable jsf tag.
though I will ask it hibernate forum too, for ebjql help.