[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
johnurban
do-not-reply at jboss.com
Wed Oct 25 09:21:30 EDT 2006
Thanks petemuir. I think you've got me on the right track now. Getting that old null exception again. I've debuged the code and I have exactly 3 rooms in my lists. The count says 3.
| 08:03:31,281 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
| java.lang.IllegalArgumentException: Value binding '#{rooms}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: roomId][Class: javax.faces.component.UISelectItems,Id: _id17]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
| at org.apache.myfaces.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:142)
| at org.apache.myfaces.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:485)
| at org.apache.myfaces.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:461)
| at org.apache.myfaces.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:272)
| at org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:246)
| at org.apache.myfaces.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
| at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
| at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
| at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_selectOneMenu_0(uQuickPersonAdd_jsp.java:838)
| at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_h_form_0(uQuickPersonAdd_jsp.java:323)
| at org.apache.jsp.uQuickPersonAdd_jsp._jspx_meth_f_view_0(uQuickPersonAdd_jsp.java:193)
| at org.apache.jsp.uQuickPersonAdd_jsp._jspService(uQuickPersonAdd_jsp.java:101)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
| at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
| at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
| at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:613)
| 08:03:31,284 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
| javax.servlet.ServletException: Value binding '#{rooms}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: roomId][Class: javax.faces.component.UISelectItems,Id: _id17]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:613)
| 08:03:31,287 INFO [SeamExceptionFilter] killing transaction
| 08:03:31,293 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
| javax.faces.FacesException: Value binding '#{rooms}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: roomId][Class: javax.faces.component.UISelectItems,Id: _id17]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
| at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
| at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:613)
| Caused by: org.apache.jasper.JasperException: Value binding '#{rooms}'of UISelectItems with component-path {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /uQuickPersonAdd.jsp][Class: javax.faces.component.html.HtmlForm,Id: _id2][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: roomId][Class: javax.faces.component.UISelectItems,Id: _id17]} does not reference an Object of type SelectItem, SelectItem[], Collection or Map but of type : null
| at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
| at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
| at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
| ... 25 more
| 08:11:19,829 INFO [STDOUT] Person Constructor called
| 08:11:19,873 WARN [HtmlLabelRenderer] Unable to find component 'firstName' (calling findComponent on component '_id2:_id5')
| 08:11:19,876 WARN [HtmlLabelRenderer] Unable to find component 'lastName' (calling findComponent on component '_id2:_id7')
| 08:11:19,878 WARN [HtmlLabelRenderer] Unable to find component 'birthday' (calling findComponent on component '_id2:_id9')
| 08:11:19,881 WARN [HtmlLabelRenderer] Unable to find component 'email' (calling findComponent on component '_id2:_id11')
| 08:11:19,884 WARN [HtmlLabelRenderer] Unable to find component 'homePhone' (calling findComponent on component '_id2:_id13')
| 08:11:19,887 WARN [HtmlLabelRenderer] Unable to find component 'comments' (calling findComponent on component '_id2:_id15')
| 08:11:48,068 INFO [STDOUT] Hibernate: select room0_.ID as ID170_, room0_.Name as Name170_, room0_.OrganizationID as Organiza3_170_, room0_.Capacity as Capacity170_ from checkin.room room0_ where room0_.OrganizationID=?
| 08:12:18,506 INFO [STDOUT] Hibernate: select room0_.ID as ID170_, room0_.Name as Name170_, room0_.OrganizationID as Organiza3_170_, room0_.Capacity as Capacity170_ from checkin.room room0_ where room0_.OrganizationID=?
|
|
| Here is my JSF:
|
|
| | <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
| | <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
| | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
| | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
| | <f:view>
| | <f:loadBundle basename="messages" var="msg"/>
| | <head>
| | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
| | <title>
| | <h:outputText value="#{msg.Create} #{msg.Person}" rendered="#{personEditor.new}"/>
| | <h:outputText value="#{msg.Update}/#{msg.Delete} #{msg.Person}" rendered="#{!personEditor.new}"/>
| | </title>
| | <style type="text/css" media="all">
| | @import "style/default/screen.css";
| | </style>
| | </head>
| | <body>
| |
| | <%@ include file="header.htm" %>
| |
| | <h:form>
| |
| | <div class="rvgFind">
| | <fieldset class="rvgFieldSet">
| | <legend><h:outputText value="#{msg.Person} #{msg.Attributes}"/></legend>
| |
| | <span class="rvgInputs">
| | <span class="rvgMeassage"><h:messages globalOnly="true"/></span>
| | <h:outputLabel value="#{msg.Person_firstName}" for="firstName">
| | <h:inputText value="#{personEditor.instance.firstName}" id="firstName"/>
| | <span class="rvgMessage"><h:message for="firstName"/></span>
| | </h:outputLabel>
| | <h:outputLabel value="#{msg.Person_lastName}" for="lastName">
| | <h:inputText value="#{personEditor.instance.lastName}" id="lastName"/>
| | <span class="rvgMessage"><h:message for="lastName"/></span>
| | </h:outputLabel>
| | <h:outputLabel value="#{msg.Person_birthday}" for="birthday">
| | <h:inputText value="#{personEditor.instance.birthday}" id="birthday">
| | <f:convertDateTime type="date" dateStyle="short"/>
| | </h:inputText>
| | <span class="rvgMessage"><h:message for="birthday"/></span>
| | </h:outputLabel>
| |
| | <h:outputLabel value="#{msg.Person_email}" for="email">
| | <h:inputText value="#{personEditor.instance.email}" id="email"/>
| | <span class="rvgMessage"><h:message for="email"/></span>
| | </h:outputLabel>
| | <h:outputLabel value="#{msg.Person_homePhone}" for="homePhone">
| | <h:inputText value="#{personEditor.instance.homePhone}" id="homePhone"/>
| | <span class="rvgMessage"><h:message for="homePhone"/></span>
| | </h:outputLabel>
| | <h:outputLabel value="#{msg.Person_comments}" for="comments">
| | <h:inputText value="#{personEditor.instance.comments}" id="comments"/>
| | <span class="rvgMessage"><h:message for="comments"/></span>
| | </h:outputLabel>
| |
| | <h:selectOneMenu id="roomId" value="#{person.room}" converter="org.jboss.seam.EntityConverter">
| | <f:selectItems value="#{rooms}"/>
| | </h:selectOneMenu>
| |
| | <span class="rvgActions">
| | <h:commandButton type="submit" value="#{msg.Create}" action="#{personEditor.create}" rendered="#{personEditor.new}"/>
| | </span>
| |
| | </fieldset>
| | </div>
| |
| | </h:form>
| |
| | </body>
| | </f:view>
| | </html>
| |
|
| Here is my Person object:
|
|
| | package testSeam;
| |
| | // Generated Sep 23, 2006 1:30:00 PM by Hibernate Tools 3.2.0.beta7
| |
| | import java.util.Date;
| | import javax.persistence.Column;
| | import javax.persistence.Entity;
| | import javax.persistence.Id;
| | import javax.persistence.Table;
| | import javax.persistence.OneToOne;
| | import javax.persistence.ManyToOne;
| |
| | /**
| | * Person generated by hbm2java
| | */
| | @Entity
| | @Table(name = "person", catalog = "checkin", uniqueConstraints = {})
| | public class Person implements java.io.Serializable {
| |
| | // Fields
| |
| | private int id;
| |
| | @ManyToOne
| | private Room room;
| |
| | @ManyToOne
| | private Organization organization;
| |
| | private String firstName;
| |
| | private String middleName;
| |
| | private String lastName;
| |
| | private String address1;
| |
| | private String city;
| |
| | private String state;
| |
| | private String zip;
| |
| | private String email;
| |
| | private Date birthday;
| |
| | private Long sex;
| |
| | private String homePhone;
| |
| | private String workPhone;
| |
| | private String beeperPhone;
| |
| | private String cellPhone;
| |
| | private String extraPhone;
| |
| | private String extraPhoneMemo;
| |
| | private String school;
| |
| | private String schoolGrade;
| |
| | private String contact;
| |
| | private String parentName;
| |
| | private String comments;
| |
| | private String minsitry;
| |
| | private Character drama;
| |
| | private Character music;
| |
| | private Long status;
| |
| | private Character visitor;
| |
| | private Character mailList;
| |
| | private Character leader;
| |
| | private Date lastAttended;
| |
| | private Date created;
| |
| | private Date updated;
| |
| | private Character vcall;
| |
| | private Character vhouseCall;
| |
| | private String team;
| |
| | private String photoFile;
| |
| | private String uniqueId;
| |
| | // Constructors
| |
| | /** default constructor */
| | public Person() {
| | System.out.println("Person Constructor called");
| | }
| |
| | /** minimal constructor */
| | /*
| | public Person(int id, int roomId, int organizationId, String firstName) {
| | System.out.println("Person Constructor called with 3 parms");
| | this.id = id;
| | this.roomId = roomId;
| | this.organizationId = organizationId;
| | this.firstName = firstName;
| | }
| | */
| |
| | /** full constructor */
| | /*
| | public Person(int id, int roomId, int organizationId, String firstName,
| | String middleName, String lastName, String address1, String city,
| | String state, String zip, String email, Date birthday, Long sex,
| | String homePhone, String workPhone, String beeperPhone,
| | String cellPhone, String extraPhone, String extraPhoneMemo,
| | String school, String schoolGrade, String contact,
| | String parentName, String comments, String minsitry,
| | Character drama, Character music, Long status, Character visitor,
| | Character mailList, Character leader, Date lastAttended,
| | Date created, Date updated, Character vcall, Character vhouseCall,
| | String team, String photoFile, String uniqueId) {
| | System.out.println("Person Constructor called with ALL parms");
| | this.id = id;
| | this.roomId = roomId;
| | this.organizationId = organizationId;
| | this.firstName = firstName;
| | this.middleName = middleName;
| | this.lastName = lastName;
| | this.address1 = address1;
| | this.city = city;
| | this.state = state;
| | this.zip = zip;
| | this.email = email;
| | this.birthday = birthday;
| | this.sex = sex;
| | this.homePhone = homePhone;
| | this.workPhone = workPhone;
| | this.beeperPhone = beeperPhone;
| | this.cellPhone = cellPhone;
| | this.extraPhone = extraPhone;
| | this.extraPhoneMemo = extraPhoneMemo;
| | this.school = school;
| | this.schoolGrade = schoolGrade;
| | this.contact = contact;
| | this.parentName = parentName;
| | this.comments = comments;
| | this.minsitry = minsitry;
| | this.drama = drama;
| | this.music = music;
| | this.status = status;
| | this.visitor = visitor;
| | this.mailList = mailList;
| | this.leader = leader;
| | this.lastAttended = lastAttended;
| | this.created = created;
| | this.updated = updated;
| | this.vcall = vcall;
| | this.vhouseCall = vhouseCall;
| | this.team = team;
| | this.photoFile = photoFile;
| | this.uniqueId = uniqueId;
| | }
| | */
| |
| | // Property accessors
| | @Id
| | @Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true)
| | public int getId() {
| | return this.id;
| | }
| |
| | public void setId(int id) {
| | this.id = id;
| | }
| |
| | // @Column(name = "RoomID", unique = false, nullable = false, insertable = true, updatable = true)
| | public Room getRoom() {
| | return this.room;
| | }
| |
| | public void setRoom(Room room) {
| | this.room = room;
| | }
| |
| | // @Column(name = "OrganizationID", unique = false, nullable = false, insertable = true, updatable = true)
| | public Organization getOrganization() {
| | return organization;
| | }
| |
| | public void setOrganization(Organization organization) {
| | this.organization = organization;
| | }
| |
| | @Column(name = "FirstName", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
| | public String getFirstName() {
| | return this.firstName;
| | }
| |
| | public void setFirstName(String firstName) {
| | this.firstName = firstName;
| | }
| |
| | @Column(name = "MiddleName", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
| | public String getMiddleName() {
| | return this.middleName;
| | }
| |
| | public void setMiddleName(String middleName) {
| | this.middleName = middleName;
| | }
| |
| | @Column(name = "LastName", unique = false, nullable = true, insertable = true, updatable = true, length = 25)
| | public String getLastName() {
| | return this.lastName;
| | }
| |
| | public void setLastName(String lastName) {
| | this.lastName = lastName;
| | }
| |
| | @Column(name = "Address1", unique = false, nullable = true, insertable = true, updatable = true, length = 90)
| | public String getAddress1() {
| | return this.address1;
| | }
| |
| | public void setAddress1(String address1) {
| | this.address1 = address1;
| | }
| |
| | @Column(name = "City", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getCity() {
| | return this.city;
| | }
| |
| | public void setCity(String city) {
| | this.city = city;
| | }
| |
| | @Column(name = "State", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
| | public String getState() {
| | return this.state;
| | }
| |
| | public void setState(String state) {
| | this.state = state;
| | }
| |
| | @Column(name = "Zip", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
| | public String getZip() {
| | return this.zip;
| | }
| |
| | public void setZip(String zip) {
| | this.zip = zip;
| | }
| |
| | @Column(name = "EMail", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
| | public String getEmail() {
| | return this.email;
| | }
| |
| | public void setEmail(String email) {
| | this.email = email;
| | }
| |
| | @Column(name = "Birthday", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
| | public Date getBirthday() {
| | return this.birthday;
| | }
| |
| | public void setBirthday(Date birthday) {
| | this.birthday = birthday;
| | }
| |
| | @Column(name = "Sex", unique = false, nullable = true, insertable = true, updatable = true, precision = 10, scale = 0)
| | public Long getSex() {
| | return this.sex;
| | }
| |
| | public void setSex(Long sex) {
| | this.sex = sex;
| | }
| |
| | @Column(name = "HomePhone", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getHomePhone() {
| | return this.homePhone;
| | }
| |
| | public void setHomePhone(String homePhone) {
| | this.homePhone = homePhone;
| | }
| |
| | @Column(name = "WorkPhone", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getWorkPhone() {
| | return this.workPhone;
| | }
| |
| | public void setWorkPhone(String workPhone) {
| | this.workPhone = workPhone;
| | }
| |
| | @Column(name = "BeeperPhone", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getBeeperPhone() {
| | return this.beeperPhone;
| | }
| |
| | public void setBeeperPhone(String beeperPhone) {
| | this.beeperPhone = beeperPhone;
| | }
| |
| | @Column(name = "CellPhone", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getCellPhone() {
| | return this.cellPhone;
| | }
| |
| | public void setCellPhone(String cellPhone) {
| | this.cellPhone = cellPhone;
| | }
| |
| | @Column(name = "ExtraPhone", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
| | public String getExtraPhone() {
| | return this.extraPhone;
| | }
| |
| | public void setExtraPhone(String extraPhone) {
| | this.extraPhone = extraPhone;
| | }
| |
| | @Column(name = "ExtraPhoneMemo", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
| | public String getExtraPhoneMemo() {
| | return this.extraPhoneMemo;
| | }
| |
| | public void setExtraPhoneMemo(String extraPhoneMemo) {
| | this.extraPhoneMemo = extraPhoneMemo;
| | }
| |
| | @Column(name = "School", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
| | public String getSchool() {
| | return this.school;
| | }
| |
| | public void setSchool(String school) {
| | this.school = school;
| | }
| |
| | @Column(name = "SchoolGrade", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
| | public String getSchoolGrade() {
| | return this.schoolGrade;
| | }
| |
| | public void setSchoolGrade(String schoolGrade) {
| | this.schoolGrade = schoolGrade;
| | }
| |
| | @Column(name = "Contact", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
| | public String getContact() {
| | return this.contact;
| | }
| |
| | public void setContact(String contact) {
| | this.contact = contact;
| | }
| |
| | @Column(name = "ParentName", unique = false, nullable = true, insertable = true, updatable = true, length = 75)
| | public String getParentName() {
| | return this.parentName;
| | }
| |
| | public void setParentName(String parentName) {
| | this.parentName = parentName;
| | }
| |
| | @Column(name = "Comments", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
| | public String getComments() {
| | return this.comments;
| | }
| |
| | public void setComments(String comments) {
| | this.comments = comments;
| | }
| |
| | @Column(name = "Minsitry", unique = false, nullable = true, insertable = true, updatable = true, length = 60)
| | public String getMinsitry() {
| | return this.minsitry;
| | }
| |
| | public void setMinsitry(String minsitry) {
| | this.minsitry = minsitry;
| | }
| |
| | @Column(name = "Drama", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getDrama() {
| | return this.drama;
| | }
| |
| | public void setDrama(Character drama) {
| | this.drama = drama;
| | }
| |
| | @Column(name = "Music", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getMusic() {
| | return this.music;
| | }
| |
| | public void setMusic(Character music) {
| | this.music = music;
| | }
| |
| | @Column(name = "Status", unique = false, nullable = true, insertable = true, updatable = true, precision = 10, scale = 0)
| | public Long getStatus() {
| | return this.status;
| | }
| |
| | public void setStatus(Long status) {
| | this.status = status;
| | }
| |
| | @Column(name = "Visitor", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getVisitor() {
| | return this.visitor;
| | }
| |
| | public void setVisitor(Character visitor) {
| | this.visitor = visitor;
| | }
| |
| | @Column(name = "Mail_List", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getMailList() {
| | return this.mailList;
| | }
| |
| | public void setMailList(Character mailList) {
| | this.mailList = mailList;
| | }
| |
| | @Column(name = "Leader", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getLeader() {
| | return this.leader;
| | }
| |
| | public void setLeader(Character leader) {
| | this.leader = leader;
| | }
| |
| | @Column(name = "Last_Attended", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
| | public Date getLastAttended() {
| | return this.lastAttended;
| | }
| |
| | public void setLastAttended(Date lastAttended) {
| | this.lastAttended = lastAttended;
| | }
| |
| | @Column(name = "Created", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
| | public Date getCreated() {
| | return this.created;
| | }
| |
| | public void setCreated(Date created) {
| | this.created = created;
| | }
| |
| | @Column(name = "Updated", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
| | public Date getUpdated() {
| | return this.updated;
| | }
| |
| | public void setUpdated(Date updated) {
| | this.updated = updated;
| | }
| |
| | @Column(name = "VCall", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getVcall() {
| | return this.vcall;
| | }
| |
| | public void setVcall(Character vcall) {
| | this.vcall = vcall;
| | }
| |
| | @Column(name = "VHouseCall", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
| | public Character getVhouseCall() {
| | return this.vhouseCall;
| | }
| |
| | public void setVhouseCall(Character vhouseCall) {
| | this.vhouseCall = vhouseCall;
| | }
| |
| | @Column(name = "Team", unique = false, nullable = true, insertable = true, updatable = true, length = 17)
| | public String getTeam() {
| | return this.team;
| | }
| |
| | public void setTeam(String team) {
| | this.team = team;
| | }
| |
| | @Column(name = "PhotoFile", unique = false, nullable = true, insertable = true, updatable = true, length = 75)
| | public String getPhotoFile() {
| | return this.photoFile;
| | }
| |
| | public void setPhotoFile(String photoFile) {
| | this.photoFile = photoFile;
| | }
| |
| | @Column(name = "UniqueID", unique = false, nullable = true, insertable = true, updatable = true, length = 45)
| | public String getUniqueId() {
| | return this.uniqueId;
| | }
| |
| | public void setUniqueId(String uniqueId) {
| | this.uniqueId = uniqueId;
| | }
| |
| | }
| |
| |
|
| Here is my Room object:
|
|
| | package testSeam;
| |
| | // Generated Oct 6, 2006 12:55:26 AM by Hibernate Tools 3.2.0.beta7
| |
| | import javax.persistence.Column;
| | import javax.persistence.Entity;
| | import javax.persistence.Id;
| | import javax.persistence.Table;
| |
| | /**
| | * Room generated by hbm2java
| | */
| | @Entity
| | @Table(name = "room", catalog = "checkin", uniqueConstraints = {})
| | public class Room implements java.io.Serializable {
| |
| | // Fields
| |
| | private int id;
| |
| | private String name;
| |
| | private int organizationId;
| |
| | private int capacity;
| |
| | // Constructors
| |
| | /** default constructor */
| | public Room() {
| | }
| |
| | /** full constructor */
| | public Room(int id, String name, int organizationId, int capacity) {
| | this.id = id;
| | this.name = name;
| | this.organizationId = organizationId;
| | this.capacity = capacity;
| | }
| |
| | // Property accessors
| | @Id
| | @Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true)
| | public int getId() {
| | return this.id;
| | }
| |
| | public void setId(int id) {
| | this.id = id;
| | }
| |
| | @Column(name = "Name", unique = false, nullable = false, insertable = true, updatable = true, length = 50)
| | public String getName() {
| | return this.name;
| | }
| |
| | public void setName(String name) {
| | this.name = name;
| | }
| |
| | @Column(name = "OrganizationID", unique = false, nullable = false, insertable = true, updatable = true)
| | public int getOrganizationId() {
| | return this.organizationId;
| | }
| |
| | public void setOrganizationId(int organizationId) {
| | this.organizationId = organizationId;
| | }
| |
| | @Column(name = "Capacity", unique = false, nullable = false, insertable = true, updatable = true)
| | public int getCapacity() {
| | return this.capacity;
| | }
| |
| | public void setCapacity(int capacity) {
| | this.capacity = capacity;
| | }
| |
| | }
| |
| |
|
| Here is my PersonEditorBean:
|
|
| | package testSeam;
| |
| | // Generated Sep 23, 2006 1:30:01 PM by Hibernate Tools 3.2.0.beta7
| |
| | import java.util.ArrayList;
| | import java.util.HashMap;
| | import java.util.Iterator;
| | import java.util.List;
| | import java.util.Map;
| | import java.util.Map.Entry;
| |
| | import javax.ejb.Remove;
| | import javax.ejb.Stateful;
| | import javax.ejb.TransactionAttribute;
| | import static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;
| | import javax.faces.application.FacesMessage;
| | import javax.faces.context.FacesContext;
| | import javax.faces.model.SelectItem;
| | import javax.interceptor.Interceptors;
| | import javax.persistence.EntityManager;
| | import javax.persistence.Query;
| |
| | import org.hibernate.validator.Valid;
| | import org.jboss.seam.ScopeType;
| | import org.jboss.seam.annotations.Begin;
| | import org.jboss.seam.annotations.Destroy;
| | import org.jboss.seam.annotations.End;
| | import org.jboss.seam.annotations.Factory;
| | import org.jboss.seam.annotations.IfInvalid;
| | import org.jboss.seam.annotations.In;
| | import org.jboss.seam.annotations.Name;
| | import org.jboss.seam.annotations.Outcome;
| | import org.jboss.seam.annotations.Scope;
| | import org.jboss.seam.ejb.SeamInterceptor;
| |
| | import org.jboss.seam.selectitems.annotations.*;
| | import org.jboss.seam.selectitems.databinding.*;
| |
| | @Name("personEditor")
| | @Stateful
| | @Scope(ScopeType.SESSION)
| | @Interceptors(SeamInterceptor.class)
| | public class PersonEditorBean implements PersonEditor {
| |
| | @In(create = true)
| | private EntityManager entityManager;
| |
| | @In(required=false)
| | private Login login;
| |
| | @Valid
| | private Person instance = new Person();
| |
| | @SelectItems(label="description", addNoSelectionLabel="Please select...")
| | private List<Room> rooms;
| |
| | private boolean isNew = true;
| |
| | private String doneOutcome = "find";
| |
| | @TransactionAttribute(NOT_SUPPORTED)
| | public Person getInstance() {
| | // System.out.println("PersonEditorBean.getInstance|");
| | return instance;
| | }
| |
| | public void setInstance(Person instance) {
| | this.instance = instance;
| | }
| |
| | @TransactionAttribute(NOT_SUPPORTED)
| | public boolean isNew() {
| | // System.out.println("PersonEditorBean.isNew|"+isNew);
| | return isNew;
| | }
| |
| | public void setNew(boolean isNew) {
| | this.isNew = isNew;
| | }
| |
| | public void setDoneOutcome(String outcome) {
| | doneOutcome = outcome;
| | }
| |
| | @In(required = false)
| | private transient PersonFinder personFinder;
| |
| | @In(create = true)
| | private transient Map messages;
| |
| | @SuppressWarnings("unchecked")
| | @Factory("rooms")
| | public void getRoomListByOrganization() { // f:selectItems value
| | Map<String, Object> parameters = new HashMap<String, Object>();
| | StringBuffer queryString = new StringBuffer();
| | Users loggedInUser = login.getInstance();
| |
| | queryString.append(" and room.organizationId = :organizationId");
| | parameters.put("organizationId", loggedInUser.getOrganizationId());
| |
| | if (queryString.length() == 0) {
| | queryString.append("select room from Room room");
| | } else {
| | queryString.delete(0, 4).insert(0,
| | "select room from Room room where");
| | }
| |
| | Query query = entityManager.createQuery(queryString.toString());
| | for (Entry<String, Object> param : parameters.entrySet()) {
| | query.setParameter(param.getKey(), param.getValue());
| | }
| | rooms = (List<Room>) query.getResultList();
| |
| | // List selectItems=new ArrayList();
| | // for (Iterator iterator = roomListByOrganization.iterator(); iterator.hasNext();)
| | // {
| | // Room value = (Room)iterator.next();
| | // SelectItem item = new SelectItem(value, value.getName());
| | // selectItems.add(item);
| | // }
| | //
| | // roomListByOrganization = selectItems;
| | //
| | // return roomListByOrganization;
| | }
| |
| | @Begin(join = true)
| | @LoggedIn
| | @IfInvalid(outcome = Outcome.REDISPLAY)
| | public String create() {
| | if (entityManager.find(Person.class, instance.getId()) != null) {
| | FacesContext.getCurrentInstance().addMessage(
| | null,
| | new FacesMessage(messages.get("Person_id") + " "
| | + messages.get("AlreadyExists")));
| | return null;
| | }
| | entityManager.persist(instance);
| | isNew = false;
| | refreshFinder();
| | return "editPerson";
| | }
| |
| | @IfInvalid(outcome = Outcome.REDISPLAY)
| | public String update() {
| | refreshFinder();
| | return null;
| | }
| |
| | @End(ifOutcome = "find")
| | public String delete() {
| | entityManager.remove(instance);
| | refreshFinder();
| | return doneOutcome;
| | }
| |
| | @End(ifOutcome = "find")
| | public String done() {
| | if (!isNew)
| | entityManager.refresh(instance);
| | return doneOutcome;
| | }
| |
| | private void refreshFinder() {
| | if (personFinder != null)
| | personFinder.refresh();
| | }
| |
| | @Destroy
| | @Remove
| | public void destroy() {
| | }
| |
| | }
| |
| |
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980700#3980700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980700
More information about the jboss-user
mailing list