[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
No problem. But ... erm ... I've another question: In my application there is a table which contains priorities. The table contains two columns: the ID and the description of the priority. On some pages the user can filter all shown entries by priority. Adding a noSelectionLabel the user has also the option to disable the filtering. But now the user should be able to filter for priorities greater or less than a distinct value, say 3. So I want to add two further rows in the si:selectItems which have this special meaning. I know that the EntityConverter can't handle rows, which are created in my bean and not persisted in the database. So I think the best solution would be a custom converter which handles the special meanings and invokes the EntityConverter for all the other cases. Is that possible? Has to be something like this (got it from the wiki): public Converter getPriorityConverter() { |return new PriorityConverterPriority() { | | protected Object getIdAsObject(String id, Class clazz) { | int priority = Integer.parseInt(id); | if(priority == -2) return SpecialPriorities.GREATER_3; | if(priority == -3) return SpecialPriorities.LESS_3; | Converter entityConverter = new EntityConverter(); | return entityConverter.getIdAsObject(id, clazz); | } | | protected String getIdAsString(Priority entity) { | return entity.getId() + ( + entity.getDescription() + ); | } |}; | } View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988735#3988735 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988735 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Nope, that won't work. A converter probably isn't suitable here. This, to me, sounds like a good use for returning the key directly to the backing bean. I've added an example to the wiki on doing this. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988791#3988791 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988791 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Ah... OK. Seems interesting. I will test it these days. I will tell you how it works. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988829#3988829 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988829 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Thanks, I've added that to wiki page View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988467#3988467 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988467 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I'm trying to use si:selectItems and I followed all the hints in the example, but I still get an exception: java.lang.NullPointerException | at org.jboss.seam.core.Messages$1.get(Messages.java:51) | at org.jboss.seam.core.Messages$1.get(Messages.java:79) | at org.jboss.seam.selectitems.jsf.SelectItemsConverter.getMessage(SelectItemsConverter.java:74) | at org.jboss.seam.selectitems.jsf.EntityConverter.loadEntityFromPersistenceContext(EntityConverter.java:122) | at org.jboss.seam.selectitems.jsf.EntityConverter.convertToObject(EntityConverter.java:48) | at org.jboss.seam.selectitems.jsf.SelectItemsConverter.getAsObject(SelectItemsConverter.java:52) | at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:651) | at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.getConvertedValue(HtmlMenuRendererBase.java:111) | at javax.faces.component.UIInput.getConvertedValue(UIInput.java:395) | at javax.faces.component.UIInput.validate(UIInput.java:349) | at javax.faces.component.UIInput.processValidators(UIInput.java:183) | at javax.faces.component.UIForm.processValidators(UIForm.java:70) | at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624) | at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:146) | at org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:262) | at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76) | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) | at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) | at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144) | 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:595) It seems that during validation the converter can't get a message. So I think I didn't setup your jars (1.1.1beta2) properly. I placed the two jars to the \WEB-INF\lib directory of my war and included them in the Class-Path entry of the manifest for the war. Do I have to do something else? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988106#3988106 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988106 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
What version of Seam? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988110#3988110 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988110 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
It's 1.0.1 GA on a AS 4.0.4 Patch1. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988116#3988116 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988116 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Ok, I've put up a new zip, same version no, with (I hope) a fix. I wasn't able to replicate your problem (I'm using 1.1.0.CR1) so let me know. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988128#3988128 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988128 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Yeah, it works. Thanks! Now I've got the real error message: Cannot access entityManager; ensure persistenceUnitJndiName is set on SelectItemsConfig class in components.xml So I've to set the JNDIName. But to which value? I didn't have a components.xml before I used si:selectItems. I set it to the jta-data-source I defined in persistence.xml: persistence | persistence-unit name=aresDatabase | providerorg.hibernate.ejb.HibernatePersistence/provider | jta-data-sourcejava:/aresDatasource/jta-data-source | ... rest omitted ... But it didn't work. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988151#3988151 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988151 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Ok, so the EntityConverter requires access to an EntityManager to load objects. Just set this as you would set up an EntityManager for Seam - component name=em class=org.jboss.seam.core.ManagedPersistenceContext | property name=persistenceUnitJndiNamejava:/selectItemsEntityManagerFactory/property | /component | | component class=org.jboss.seam.selectitems.SelectItemsConfig | property name=persistenceUnitJndiNamejava:/selectItemsEntityManagerFactory/property | /component View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988158#3988158 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988158 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
So in persistence.xml you need to define property name=jboss.entity.manager.factory.jndi.name value=java:/selectItemsEntityManagerFactory/ And use the value of this as the value of the persistenceUnitJndiName View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988160#3988160 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988160 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Btw. regarding your comment on a step-by-step guide, if you feel like writing up how you got SeamSelectItems up and running, I'll quite happily edit it and include it in the wiki page. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988161#3988161 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988161 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Ah. OK. I didn't set this value in persistence.xml. What does this property do? I try to explain it for my own: In persistence.xml I'm setting up how to connect the database. Whit the property you mentioned I give it a JNDI name?!? And this JNDI name is the value that is needed by the SelectItemsConfig. Right? BTW: I just use the annotation @PersistenceContext(name=aresDatabase) to inject the EntityManager in each component that needs the EntityManager. I saw some guys using only the @In annotation. Why does it work for them? Does it have to do with the org.jboss.seam.core.ManagedPersistenceContext property in components.xml? Where do I find more to read on this topic? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988174#3988174 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988174 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
property name=jboss.entity.manager.factory.jndi.name value=.../ causes jboss to publish an EntityManagerFactory in JNDI for this PersistenceContext. As I mentioned above EntityConverter requires access to your EntityManager. You tell SelectItemsConfig the name under which the EntityManagerFactory is published in JNDI, the EntityConverter can then do a JNDI lookup for this factory, and thus create an EntityManager. SelectItemsConfig is just a simple bean which can be configured by components.xml and then read by the various other classes (which aren't Seam components so can't be configured by components.xml directly) If you want to @In your EntityManager you need to configure a Seam Managed Persistence Context, this is covered in the reference manual. http://docs.jboss.com/seam/1.1CR1/reference/en/html/configuration.html#d0e6249 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988179#3988179 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988179 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
*dancing on my desk* It works ... I'v full access on all the columns entity B and entity A have. And I can choose an entity B from a dropdown to save in entity A. It's just great. Thank you Mr Muir. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988177#3988177 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988177 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I've got an appointment so I quickly wrote down what I've done: 1. Download selectitems.jar and selectitems-ui.jar. 2. Place them in WEB-INF/lib of your war file. 3. Add following property to your persistence.xml: property name=jboss.entity.manager.factory.jndi.name value=java:/selectItemsEntityManagerFactory/ 4. Add following entry to your components.xml: component class=org.jboss.seam.selectitems.SelectItemsConfig | property name=persistenceUnitJndiNamejava:/selectItemsEntityManagerFactory/property | /component As you might guess the property has to be the same value you set in persistence.xml. 5. Now you can establish the relationships between your entities using @OneToOne and so on. (Don't forget to adjust getters and setters) 6. The method which outjected the SelectItems can now be rewritten to outject an list containing the entities. 7. Use si:selectItems to retrive the entities. With attribute label you can define the label shown on each row. To use si you have to include xmlns:si=http://jboss.com/products/seam/selectitems/taglib; and xmlns:s=http://jboss.com/products/seam/taglib; You have to use attributes Value, var and label. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988182#3988182 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988182 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I#ve got the same problem. The real differences between your and my version is the usage of the EntityConverter and the @SelectItems. Could you please tell me what you did to get it working? Do I have to use @SelectItems and/or the EntityConverter or does it also work with a pure Seam? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3987895#3987895 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3987895 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Well there are really two approaches: 1) Traditional JSF - write a converter and outject a List - this is described on the wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=SelectItems 2) Use the SeamSelectItems package - an old version of which is being discussed here View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3987907#3987907 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3987907 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Hmm. OK. Yesterday I searched around the web for possibilities to handle a ManyToOne-releationship in a dropdown-box. And I think that your http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamSelectItemsNewDesign offers all the things I need with a great usability. But I think there should be a guideline or an explanation on how to use it, step-by-step. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3988066#3988066 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3988066 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I was able to get the example working after closely following your example Mr. Muir. Thank you. In your example you have Client and ClientType POJO's. My next hurdle is getting the Client object to persist from a JSF. Is there an example already out there showing how to persist an object that has a dropdown/lookup, reference as an @ManyToOne? My JSF seems to pass validation, however I keep getting unable to access entity manager as a return message in my JSF. No exceptions come up the stack trace and the action event never gets called. So, some magic is happening between jsf submit and RoomServiceBean. 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=#{roomService.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 |legendh:outputText value=#{msg.Person} #{msg.Attributes}//legend | |span class=rvgInputs | span class=rvgMeassageh:messages globalOnly=false//span | | h:selectOneMenu value=#{person.room} converter=org.jboss.seam.EntityConverter |f:selectItems value=#{rooms} / | /h:selectOneMenu | h:selectOneMenu value=#{person.organization} converter=org.jboss.seam.EntityConverter |f:selectItems value=#{organizations} / | /h:selectOneMenu | | h:outputLabel value=#{msg.Person_firstName} |h:inputText value=#{person.firstName} id=firstName/ |span class=rvgMessageh:message for=firstName//span | /h:outputLabel | h:outputLabel value=#{msg.Person_middleName} |h:inputText value=#{person.middleName} id=middleName/ |span class=rvgMessageh:message for=middleName//span | /h:outputLabel | h:outputLabel value=#{msg.Person_lastName} |h:inputText value=#{person.lastName} id=lastName/ |span class=rvgMessageh:message for=lastName//span | /h:outputLabel | | h:outputLabel value=#{msg.Person_birthday} for=birthday |h:inputText value=#{person.birthday} id=birthday |f:convertDateTime type=date dateStyle=short/ |/h:inputText |span class=rvgMessageh:message for=birthday//span | /h:outputLabel | | h:outputLabel value=#{msg.Person_address1} for=address1 |h:inputText value=#{person.address1} id=address1/ |span class=rvgMessageh:message for=address1//span | /h:outputLabel | h:outputLabel value=#{msg.Person_city} for=city |h:inputText value=#{person.city} id=city/ |span class=rvgMessageh:message for=city//span | /h:outputLabel | h:outputLabel value=#{msg.Person_state} for=state |h:inputText value=#{person.state} id=state/ |span class=rvgMessageh:message for=state//span | /h:outputLabel | h:outputLabel value=#{msg.Person_zip} for=zip |h:inputText value=#{person.zip} id=zip/ |span class=rvgMessageh:message for=zip//span | /h:outputLabel | h:outputLabel value=#{msg.Person_email} for=email |h:inputText value=#{person.email} id=email/ |span class=rvgMessageh:message for=email//span | /h:outputLabel | h:outputLabel value=#{msg.Person_sex} for=sex |h:inputText value=#{person.sex} id=sex/ |span class=rvgMessageh:message for=sex//span | /h:outputLabel | h:outputLabel value=#{msg.Person_homePhone} for=homePhone |h:inputText value=#{person.homePhone} id=homePhone/ |span class=rvgMessageh:message for=homePhone//span | /h:outputLabel | h:outputLabel value=#{msg.Person_workPhone} for=workPhone |h:inputText value=#{person.workPhone} id=workPhone/ |span class=rvgMessageh:message for=workPhone//span | /h:outputLabel | h:outputLabel value=#{msg.Person_beeperPhone} for=beeperPhone |h:inputText value=#{person.beeperPhone} id=beeperPhone/ |span class=rvgMessageh:message for=beeperPhone//span | /h:outputLabel | h:outputLabel value=#{msg.Person_cellPhone}
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
johnurban wrote : So, some magic is happening between jsf submit and RoomServiceBean. Yes it is :) Check you've configured org.jboss.seam.selectitems.SelectItemsPersistenceConfig - persistenceUnitJndiName in components.xml - it should be set the same as org.jboss.seam.core.ManagedPersistenceContext - persistenceUnitJndiName View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3982423#3982423 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3982423 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
my components.xml | ?xml version=1.0 encoding=utf-8? | components | component name=org.jboss.seam.core.init | property name=myFacesLifecycleBugtrue/property | property name=jndiPatternseamapp/#{ejbName}/local/property | /component | component name=entityManager class=org.jboss.seam.core.ManagedPersistenceContext | property name=persistenceUnitJndiNamejava:/seamappEntityManagerFactory/property | /component | component class=org.jboss.seam.selectitems.SelectItemsPersistenceConfig | property name=persistenceUnitJndiNamejava:/selectItemsEntityManagerFactory/property | /component | !-- | component name=org.jboss.seam.core.manager | property name=conversationTimeout12/property | /component | | component class=org.jboss.seam.core.Ejb installed=false/ | -- | /components | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3982447#3982447 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3982447 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I should also say, that the rooms and organization lookups work fine using the EntityManager from inside RoomServiceBean. But it appears that the the jsf is trying to access the EntityManager from somewhere other than than RoomServiceBean, because I get no System.out messages once I click on the roomService.addNewPerson button. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3982448#3982448 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3982448 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
petemuir wrote : Check you've configured org.jboss.seam.selectitems.SelectItemsPersistenceConfig - persistenceUnitJndiName in components.xml - it should be set the same as org.jboss.seam.core.ManagedPersistenceContext - persistenceUnitJndiName component class=org.jboss.seam.selectitems.SelectItemsPersistenceConfig | property name=persistenceUnitJndiNamejava:/seamappEntityManagerFactory/property | /component This is explained on the wiki and in the readme. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3982449#3982449 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3982449 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Wow, I get to answer my own question for a change: The validation error was resolved when I read the example by Mr. Muir. I had to override the equals method: | @Override | public boolean equals(Object obj) { | if (!(obj != null obj instanceof Room)) | return false; | Room rm = (Room) obj; | | if (this.id.equals(rm.id)) | return true; | | return false; | } | The next problem I got I fixed reading another forum post.. changing the entityManager.persist to entitymanager.merge I GOT THE Record to ADD!! View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3982557#3982557 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3982557 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
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
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
I'm still concerned about personEditor having a SESSION scope [1]. I would suggest trying a really simple stateless session bean that just returns all the rooms in your data: ... | @SelectItems(label=description) | ListRoom allRooms; | | @Factory(allRooms) | void getRoomList() { |allRooms = entityManager.createQuery(select room from Room room).getResultList(); | } | ... and see if you can get that displaying on your JSF page. Then work up from there. In general I would suggest always using much simpler jsf/beans whilst debugging something like this and working up to a complex setup - something else could be causing the problem but be hidden. The example is probably a good place to start - the only reason the backing bean is conversational is to show state being saved, the interesting stuff (@SelectItems) could easily be stateless. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3980707#3980707 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3980707 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Thanks. Looks like my decision to add to the already generated code was a bad idea. I like your idea of simplifying. So that brings me to a design question: In this case should I create a new SLSB to persist the new person record rather than the generated PersonEditorBen(SFSB)? If I do create a new SLSB, can I make it do the room lookup, extract the data from jsp and add the record to the person table. Or, does this SLSB need be to specifically for the room lookup? If so, do I always need to user SLSB when doing fancy dropdown lookups on tables? In Seam what are the best guidelines for determining when/when not to use SLSB/SFSB? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3980778#3980778 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3980778 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
anonymous wrote : In Seam what are the best guidelines for determining when/when not to use SLSB/SFSB? This is an interesting question. I think the answer depends on style/what you are doing. I'm increasingly using the pattern of a stateful component to manage the flow and a stateless 'service' bean to do the rest of the work. I use bijection to pass any object required (so far only entities) between them. The advantage of this approach I find is that, firstly, you seperate workflow logic from 'helper' methods resulting in clearer code (for example, deleting a user vs. reseting the password), secondly, it makes the 'helper' methods resuable (e.g. a nationality dropdown might be used in various places in your ui, so you want its content to be generated in a stateless fashion). The disadvantage is complexity - and I am developing a complex workflow involving jbpm. So, what I would do is create a 'roomService' bean which contains any non-workflow-related methods for rooms (e.g. drop down lists, generating access codes), and a 'roomCRUD' bean that contains the workflow methods. That doesn't mean its the best approach but it works well for me and avoids a lot of the concurrent access problems to stateful beans (though I believe the new seam fixes this). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3980785#3980785 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3980785 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
Have you tried the example in my selectitems code (http://jroller.com/page/pmuir?entry=selectitems_revisited). It contains both a select many and select one drop down that will end up being represented as youy suggest. If you have problems getting the example running (follow the readme) let me know. There are a couple of bugs in it which I plan to fix later today. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3980387#3980387 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3980387 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user