[jboss-user] [JBoss Seam] - SeamSelectItems - Not selecting Item Throws Exception

johnurban do-not-reply at jboss.com
Fri Nov 3 23:30:35 EST 2006


I did have this working, throwing up a message telling the user to select a value. In finally getting my object to persist to the DB, I have tampered w/ the non selection logic. Getting this Exception:


  | 22:09:11,870 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
  | javax.servlet.ServletException: Error calling action method of component with id _id0:_id14
  |         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)
  | 22:09:11,871 INFO  [SeamExceptionFilter] killing transaction
  | 22:09:11,874 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
  | javax.faces.FacesException: Error calling action method of component with id _id0:_id14
  |         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
  |         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
  |         at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
  |         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
  |         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
  |         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
  |         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
  |         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: javax.faces.el.EvaluationException: Exception while invoking expression #{roomService.addNewPerson}
  |         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
  |         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
  |         ... 27 more
  | Caused by: javax.ejb.EJBTransactionRolledbackException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: testSeam.Person.room
  |         at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
  |         at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
  |         at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
  |         at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  |         at $Proxy1034.addNewPerson(Unknown Source)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
  |         ... 28 more
  | Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: testSeam.Person.room
  |         at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
  |         at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:210)
  |         at testSeam.RoomServiceBean.addNewPerson(RoomServiceBean.java:147)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  |         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
  |         at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:45)
  |         at sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:33)
  |         at sun.reflect.GeneratedMethodAccessor495.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
  |         at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
  |         at sun.reflect.GeneratedMethodAccessor494.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
  |         at sun.reflect.GeneratedMethodAccessor493.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at testSeam.LoggedInInterceptor.checkLoggedIn(LoggedInInterceptor.java:39)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:30)
  |         at sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
  |         at sun.reflect.GeneratedMethodAccessor492.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  |         at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  |         at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  |         at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
  |         at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
  |         at sun.reflect.GeneratedMethodAccessor491.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
  |         at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
  |         ... 48 more
  | Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: testSeam.Person.room
  |         at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
  |         at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:284)
  |         at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
  |         at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
  |         at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:165)
  |         at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:102)
  |         at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51)
  |         at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:679)
  |         at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:663)
  |         at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:667)
  |         at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:201)
  |         ... 126 more
  | 
  | 
  | Person.java:
  | 
  | 
  |   | 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;
  |   | import javax.persistence.JoinColumn;
  |   | import javax.persistence.GeneratedValue;
  |   | 
  |   | import org.jboss.seam.annotations.Scope;
  |   | import org.jboss.seam.annotations.Name;
  |   | import static org.jboss.seam.ScopeType.SESSION;
  |   | 
  |   | /**
  |   |  * Person generated by hbm2java
  |   |  */
  |   | @Entity
  |   | @Name("person")
  |   | @Scope(SESSION)
  |   | @Table(name = "person", catalog = "checkin", uniqueConstraints = {})
  |   | public class Person implements java.io.Serializable {
  |   | 
  |   | 	// Fields    
  |   | 
  |   | 	private int id;
  |   | 	
  |   | 	private Room room;
  |   | 
  |   | 	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");
  |   | 	}
  |   | 
  |   | 	// Property accessors
  |   | 	@Id
  |   |         @GeneratedValue
  |   | 	public int getId() {
  |   | 		return this.id;
  |   | 	}
  |   | 
  |   | 	public void setId(int id) {
  |   | 		this.id = id;
  |   | 	}
  |   | 
  |   |         @ManyToOne(optional=false)
  |   |         @JoinColumn(name="roomId")
  |   | 	public Room getRoom() {
  |   | 		return this.room;
  |   | 	}
  |   | 
  |   | 	public void setRoom(Room room) {
  |   | 		this.room = room;
  |   | 	}
  |   | 
  |   |         @ManyToOne(optional=true)
  |   |         @JoinColumn(name="organizationId")
  |   | 	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;
  |   | 	}
  |   | 
  |   | }
  |   | 
  |   | 
  | 
  | RoomServiceBean.java
  | 
  | 
  |   |  package testSeam;
  |   |   
  |   | // Generated Oct 6, 2006 12:55:26 AM by Hibernate Tools 3.2.0.beta7
  |   |  
  |   | import java.util.ArrayList;
  |   | import java.util.Iterator;
  |   | import java.util.Map;
  |   | import java.util.List;
  |   | import javax.ejb.Remove;
  |   | import javax.ejb.Stateless;
  |   | 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 org.jboss.seam.annotations.Begin;
  |   | import org.jboss.seam.annotations.Destroy;
  |   | import org.jboss.seam.annotations.End;
  |   | import org.jboss.seam.annotations.IfInvalid;
  |   | import org.jboss.seam.annotations.In;
  |   | import org.jboss.seam.annotations.Out;
  |   | import org.jboss.seam.annotations.Name;
  |   | import org.jboss.seam.annotations.Outcome;
  |   | import org.jboss.seam.annotations.Logger;
  |   | import org.jboss.seam.annotations.Factory;
  |   | 
  |   | import org.jboss.seam.ejb.SeamInterceptor;
  |   | import org.jboss.seam.log.Log;
  |   | import org.jboss.seam.selectitems.annotations.SelectItems;
  |   | 
  |   | import org.hibernate.validator.Valid; 
  |   | 
  |   | @Name("roomService")
  |   | @Stateless
  |   | @Interceptors(SeamInterceptor.class)
  |   | @CheckLoggedIn
  |   | public class RoomServiceBean implements RoomService {
  |   |     @Logger
  |   |     private Log log;
  |   | 
  |   |     @In(create = true)
  |   |     private EntityManager entityManager;
  |   | 
  |   |     @In(required=false)
  |   |     private Login login;
  |   | 
  |   |     private Room room = new Room();
  |   | 
  |   |     @In(value="person", create=true)
  |   |     @Out
  |   |     private Person person = new Person();
  |   | 
  |   |     private String doneOutcome = "find";
  |   | 
  |   |     @In(required = false)
  |   |     private transient RoomFinder roomFinder;
  |   | 
  |   |     @In(create = true)
  |   |     private transient Map messages;
  |   | 
  |   |     private boolean isNew = true;
  |   | 	
  |   |     @SelectItems(label="name", addNoSelectionLabel="Please select a room")
  |   |     private List<Room> rooms;
  |   | 
  |   |     @SelectItems(label="name", addNoSelectionLabel="Please select an organization")
  |   |     private List<Organization> organizations;
  |   | 
  |   |     @TransactionAttribute(NOT_SUPPORTED)
  |   |     public Person getPerson() {
  |   |         System.out.println("PersonEditorBean.getPerson|"+person);
  |   |         return person;
  |   |     }
  |   | 
  |   |     public void setPerson(Person person) {
  |   |         System.out.println("PersonEditorBean.setPerson|"+person);
  |   |         this.person = person;
  |   |     }
  |   | 
  |   |     @TransactionAttribute(NOT_SUPPORTED)
  |   |     public Room getRoom() {
  |   |         return room;
  |   |     } 
  |   | 
  |   |     public void setRoom(Room room) {
  |   |         this.room = room;
  |   |     }
  |   | 
  |   |     @TransactionAttribute(NOT_SUPPORTED)
  |   |     public boolean isNew() {
  |   |         return isNew;
  |   |     }
  |   | 
  |   |     public void setNew(boolean isNew) {
  |   |         this.isNew = isNew;
  |   |     }
  |   | 
  |   |     public void setDoneOutcome(String outcome) {
  |   |          doneOutcome = outcome;
  |   |     }
  |   | 
  |   |     @SuppressWarnings("unchecked")
  |   |     @Factory("rooms")
  |   |     @LoggedIn
  |   |     public void buildRooms() {
  |   |         log.info("top of buildRooms()");
  |   |         Users loggedInUser = login.getInstance();
  |   | 
  |   |         StringBuffer queryString = new StringBuffer();
  |   |         queryString.append("select rm from Room rm ");
  |   |         queryString.append(" where rm.organizationId = "+loggedInUser.getOrganizationId());
  |   | 
  |   |         rooms = entityManager.createQuery(queryString.toString()).getResultList();
  |   |         log.info("Room list has " + rooms.size() + " entries");
  |   |     }
  |   | 
  |   |     @SuppressWarnings("unchecked")
  |   |     @Factory("organizations")
  |   |     public void buildOrganizations() {
  |   |         log.info("top of buildOrganizations()");
  |   |         organizations = entityManager.createQuery("select org from Organization org").getResultList();
  |   |         log.info("Organization list has " + organizations.size() + " entries");
  |   |     }
  |   | 
  |   |     @Begin(join = true)
  |   |     @IfInvalid(outcome = Outcome.REDISPLAY)
  |   |     @LoggedIn
  |   |     public String addNewPerson() {
  |   |         log.info("... about to call entityManager.find:"+person+"|"+person.getId());
  |   | 
  |   |         Users loggedInUser = login.getInstance();
  |   | 
  |   |         Organization org = new Organization();
  |   |         org.setId(loggedInUser.getOrganizationId());
  |   |         person.setOrganization(org);
  |   | 
  |   |         if (entityManager.find(Person.class, person.getId()) != null) {
  |   |             log.info("top of RoomServieBean.addNewPerson()");
  |   |             FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(messages.get("Person_id") + " " + messages.get("AlreadyExists")));
  |   |             return null;
  |   |         }
  |   | 
  |   |         entityManager.merge(person);
  |   |         isNew = false;
  |   |         refreshFinder();
  |   |         FacesContext.getCurrentInstance().addMessage( null, new FacesMessage("Person added successfully..."));
  |   |         return "uPersonCheckin";
  |   |     }
  |   | 
  |   |     @IfInvalid(outcome = Outcome.REDISPLAY)
  |   |     public String update() {
  |   |         refreshFinder();
  |   |         return null;
  |   |     }
  |   | 
  |   |     @End(ifOutcome = "find")
  |   |     public String delete() {
  |   |         entityManager.remove(room);
  |   |         refreshFinder();
  |   |         return doneOutcome;
  |   |     }
  |   | 
  |   |     @End(ifOutcome = "find")
  |   |     public String done() {
  |   |         if (!isNew)
  |   |             entityManager.refresh(room);
  |   |         return doneOutcome;
  |   |     }
  |   | 
  |   |     private void refreshFinder() {
  |   |         if (roomFinder != null)
  |   |             roomFinder.refresh();
  |   |     }
  |   | }
  |   | 
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983165#3983165

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983165



More information about the jboss-user mailing list