i just did it and its quite simple...
you need the add a getter for the list of the many relation.
in you jsp file i will find this:
<!-- todo: change this to read the identifier field from the other
pojo -->
<s:select name="contactPerson.relation.id" list="relationList"
listKey="id" listValue="companyName"></s:select>
you don't need to change any thing. only make in your action a get*list
to return the list.
in my case a public List<Relation> getRelationList(){return
genericRelationManager.getAll();}
(pseudo code)
mayby a good idea to write an tutorial about this. or to make the
appfuse:gen add this getter.
matt you say you don't have a good idea what to do. is this not a good idea?
tibi
Matt Raible wrote:
> Here's the error that's causing the problem:
>
> |Caused by: org.springframework.dao.DataIntegrityViolationException: not-null
> property references a null or transient value:
> cl.lejadesh.app.model.Persona.comuna; nested exception is
> org.hibernate.PropertyValueException: not-null property references a null or
> transient value: cl.lejadesh.app.model.Persona.comuna
>
>
>
> |
> It looks like you need to populate part of your object before calling
> save.
>
> Matt
>
> 2009/5/1 Leonardo Castaño <[email protected]
> <mailto:[email protected]>>
>
> I am fix the edit problem...
> but i have the follow problem when press the button SAVE, may be
> you have a clue to give me ...
>
> Tks Matt
>
> |javax.faces.FacesException: Error calling action method of component
> with id personaForm:save
> at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:69)
> at javax.faces.component.UICommand.broadcast(UICommand.java:121)
> at
> org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
> at
> org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
> at
> org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
> at
> org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
> at
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
> at
> org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
> at
> org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> cl.lejadesh.app.webapp.filter.MessageFilter.doFilter(MessageFilter.java:46)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
> at
> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
> at
> org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
> at
> org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
> at
> org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(GzipFilter.java:75)
> at
> net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:92)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> cl.lejadesh.app.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:74)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
> at
> org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
> at
> org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:172)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:268)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:87)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:61)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
> at
> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
> at
> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
> at
> org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
> at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
> at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
> Caused by: javax.faces.el.EvaluationException: javax.el.ELException:
> /personaForm.xhtml @29,117 action="#{personaForm.save}":
> org.springframework.dao.DataIntegrityViolationException: not-null property
> references a null or transient value: cl.lejadesh.app.model.Persona.comuna;
> nested exception is org.hibernate.PropertyValueException: not-null property
> references a null or transient value: cl.lejadesh.app.model.Persona.comuna
> at
> javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:79)
> at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:54)
> ... 87 more
> Caused by: javax.el.ELException: /personaForm.xhtml @29,117
> action="#{personaForm.save}":
> org.springframework.dao.DataIntegrityViolationException: not-null property
> references a null or transient value: cl.lejadesh.app.model.Persona.comuna;
> nested exception is org.hibernate.PropertyValueException: not-null property
> references a null or transient value: cl.lejadesh.app.model.Persona.comuna
> at
> com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:74)
> at
> javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:75)
> ... 88 more
> Caused by: org.springframework.dao.DataIntegrityViolationException:
> not-null property references a null or transient value:
> cl.lejadesh.app.model.Persona.comuna; nested exception is
> org.hibernate.PropertyValueException: not-null property references a null or
> transient value: cl.lejadesh.app.model.Persona.comuna
> at
> org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:630)
> at
> org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:738)
> at
> org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:614)
> at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
> at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
> at
> org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy49.save(Unknown Source)
> at
> cl.lejadesh.app.webapp.action.PersonaForm.save(PersonaForm.java:49)
> 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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
> at
> com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
> at
> com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
> ... 89 more
> Caused by: org.hibernate.PropertyValueException: not-null property
> references a null or transient value: cl.lejadesh.app.model.Persona.comuna
> at
> org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
> at
> org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:270)
> at
> org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:128)
> at
> org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
> at
> org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
> at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> at
> org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> at
> org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
> at
> org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:606)
> ... 106 more|
>
>
> :)
>
>
> 2009/5/2 Matt Raible <[email protected]
> <mailto:[email protected]>>
>
> Yes, this is correct.
>
>
> 2009/5/1 Leonardo Castaño <[email protected]
> <mailto:[email protected]>>
>
> When we are going to generate a related table, only we
> need to change the JSF Templates in webapp.action and
> htmlx in webapp?
>
> We dont need to create a new Dao and DaoHibernate?
>
>
>
> 2009/5/2 Matt Raible <[email protected]
> <mailto:[email protected]>>
>
> AMP doesn't support one-to-many and man-to-many
> relationships, so if you had those in your POJOs when
> you generated the code, chances are incorrect code was
> generated. The reason we don't support these is we
> haven't figured out the best pattern and code to
> generate. I'd be happy to support them if I had the
> knowledge of how to do it.
>
> Matt
>
> 2009/5/1 Leonardo Castaño <[email protected]
> <mailto:[email protected]>>
>
> Hello, I have the following error when try to edit
> the persona item, I have two tables related
> Persona and Comuna, I have run
>
> I have created two related tables in mysql and run
> followin
> mvn appfuse:gen -Dentity=Persona
> mvn appfuse:gen -Dentity=Comuna
>
> all rigth in appfuse log
> then run
> mvn jetty:run
> then the error is when I try to edit one "persona"
> item by browser
>
> An Error Occurred:
>
> Exception while calling encodeEnd on component :
> {Component-Path : [Class:
> org.ajax4jsf.framework.ajax.AjaxViewRoot,ViewId:
> /personaForm.xhtml][Class:
> javax.faces.component.html.HtmlForm,Id:
> personaForm][Class:
> javax.faces.component.html.HtmlPanelGrid,Id: j_id2]}
>
> Some one help me please !!
> Tkz
>
>
> --
> Leonardo Castaño D.
> Listening http://www.concierto.cl/envivo.asp music
> of the 80s <http://www.concierto.cl/envivo.asp>
>
>
>
>
>
> --
> Leonardo Castaño D.
>
>
>
>
>
> --
> Leonardo Castaño D.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]