8 Replies Latest reply on Mar 31, 2007 3:13 PM by ir vega

    COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!

    ir vega Newbie

      The prupose of this post is to save future, new SEAM users hours if not days.

      Given what SEAM is and what it is capable of, the solution for someone with some relevant knowledge will probably take less time than it took to write this. In theory, a solution will take only a few minutes to develop, test and deploy.
      I hope that a few of you will be able to quickly knock-up a full, working solution that meets the following very simple (but of a commonly occurring class of problem's) requirements ... or at least have a go so you can learn how to deal with the issues you may face.

      Such an example, simple as it is, should help those wishing to evaluate SEAM.

      See the schema below (all the sql runs in HSQLDB 1.8.0.1)
      Create just 1 screen for creating records in MOLECULE with
      1 - a drop-down list showing the ATOMs' PT_SYMBOLs
      2 - a drop-down list showing the COMPOUNDs' NAMEs
      3 - a text field for the QUANTITY
      4 - a button to add the above values into the MOLECULE table

      Please do not change the schema(below) and do not use JSPs if possible.
      Provide a short note saying how long it took to design and develop your solution in SEAM and note where you had to make some tweaks to the OOTB behaviour of seam-gen or if you just hand-coded the whole lot.
      Include all artefacts in your post - don't assume anything is obvious (especially to me).

      Here's your schema:

      CREATE TABLE ATOM (
       ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,
       PT_SYMBOL VARCHAR(3)
      )
      
      CREATE TABLE COMPOUND (
       ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,
       NAME VARCHAR(10)
      )
      
      CREATE TABLE MOLECULE(
       ATOM_ID BIGINT,
       COMPOUND_ID BIGINT,
       QUANTITY INTEGER,
       PRIMARY KEY(ATOM_ID,COMPOUND_ID),
       CONSTRAINT VALID_ATOM FOREIGN KEY (ATOM_ID) REFERENCES ATOM(ID_),
       CONSTRAINT VALID_COMPOUND FOREIGN KEY (COMPOUND_ID) REFERENCES COMPOUND(ID_)
      )
      


      You can also add the following data in case empty tables cause you grief (if so, please say why)...

      INSERT INTO ATOM (PT_SYMBOL) VALUES('H');
      INSERT INTO ATOM (PT_SYMBOL) VALUES('O');
      INSERT INTO COMPOUND (NAME) VALUES('Water');
      INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(1,1,2);
      INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(2,1,1);
      INSERT INTO COMPOUND (NAME) VALUES('CarbonDioxide');
      INSERT INTO ATOM (PT_SYMBOL) VALUES('C');
      INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(3,2,1);
      INSERT INTO MOLECULE (ATOM_ID,COMPOUND_ID,QUANTITY) VALUES(2,2,2);
      


      Finally, this should give some sensible output (a sanity-check) before you start coding:

      SELECT C.NAME, A.PT_SYMBOL,M.QUANTITY
      FROM ATOM A, COMPOUND C, MOLECULE M
      WHERE M.ATOM_ID = A.ID_
       AND M.COMPOUND_ID = C.ID_
      


        • 1. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
          Chuck Adams Novice

          This is not a good way to get people to write your program for you. Anyway, seam-gen will generate almost all this for you. If you find seam-gen isn't sufficient for the purpose, consider filing a feature request instead of some challenge (which in my inbox looked a whole lot like spam)


          • 2. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
            ir vega Newbie

            Thanks for your input.
            Did you read the original post carefully - there's no need to answer unless you know, or want to know, a bit about SEAM and have some advice/ideas/questions on the topic and the issues it will raise.

            • 3. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
              Bengt Larsson Newbie

              You think this was the good easy screen for new seam developer and team ? :-))
              We look at seam for all this week in Goteborg company. Today seam is working good already in many sample application (booking is very good) with jBoss distribution. seam is good on Eclipse IDEs. Seam gen is working good for on simple tables and simple screen. Architecture looks clever and scalable.
              We will propose soon a solution for bank company with jBoss and maybe seam (Operational Risk).
              Of course we must have also manay to many with this schema in the bank so we try this problem today in office and also now, tonight in home :-(
              We want to use seam and java (not sure Ruby so far) with our project, rich-intranet bank application also.
              This question is nice for us with this customer, and schema and SQL works good in hsql, cheers, but seam gen haves mappings problem to deploy. So we cant deploy toniht and tired now. We can look tomorow more because we have same problem for this bank.
              Is this what does happen for you? Have you now way to make it work? I look with my team tomorrow and architect as well.
              RedHat: Is it easy to build a screen in SEAM for this screen with add molecule? Can anybody from RedHat know this before Thurdag morning in centrum Europe time? If it is not possible can you write it in a reply.
              PS Gavin, how you do find time to help everybody ?
              PPS If you have know the solution cja987, we can promise not sell your solution to BASF or a US pharmaceuticals ;-))
              Thank you if you can help us.

              • 4. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
                Pete Muir Master

                This would be my approach:

                1) Use seam-gen to generate an app (not using reveng of tables)

                2) Translate your schema into JPA/EJB3 entity beans with appropriate annotations

                3) Create the relevant framework components (i.e. a entityquery for atoms and compounds, entityhome for molecule

                4) Create a simple CRUD screen using a mixture of h:inputText, h:commandButton s:selectItems and s:convertEntity

                • 5. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
                  Bengt Larsson Newbie

                  Hej, what are you doing? :-) Thank you!! Some people has played with this many-to-manay for us, is nearly perfact today!! In this new 1.2.1 nearly everythings work!
                  We spend 12 hours in day and no result in seam 1.2.0. Now everything nearly working in 5 minuter with molecules schemas from top in thread. You can try so easy alao.
                  Can you know how we can fix the last (9, 10)? We are thanking you again.

                  1- creates database
                  2-

                  ./seam setup

                  3-
                  ./seam new-project

                  4-
                  ./seam generate-entities

                  5-
                  ./seam deploy
                  - IT DEPLOY NO ERROR :-) !!!
                  6- got o localhost:8080/molecule - :-)
                  7- make a new/search/list atom - :-)
                  8- make a new/search/list compound- :-)
                  9- molecule screen does shows only keys only from atom/compound (not descriptivs name / symbol) :-(
                  10- select atom/compund add in molecule/exception to save it :-((


                  23:16:51,312 INFO [STDOUT] Hibernate: select top ? molecule0_.ATOM_ID as ATOM1_2_, molecule0_.COMPOUND_ID as COMPOUND2_2_, molecule0_.QUANTITY as QUANTITY2_ from PUBLI
                  23:16:54,656 INFO [STDOUT] Hibernate: select top ? compound0_.ID_ as ID1_1_, compound0_.NAME as NAME1_ from PUBLIC.COMPOUND compound0_
                  23:17:00,187 INFO [STDOUT] Hibernate: select top ? atom0_.ID_ as ID1_0_, atom0_.PT_SYMBOL as PT2_0_ from PUBLIC.ATOM atom0_
                  23:17:21,281 INFO [STDOUT] Hibernate: insert into PUBLIC.MOLECULE (QUANTITY, ATOM_ID, COMPOUND_ID) values (?, ?, ?)
                  23:17:21,281 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
                  23:17:21,281 ERROR [JDBCExceptionReporter] failed batch
                  23:17:21,281 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
                  org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
                  at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
                  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
                  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
                  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
                  at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
                  at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
                  at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                  at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)
                  at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:83)
                  at org.jboss.seam.framework.EntityHome.persist(EntityHome.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 org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                  at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                  at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
                  at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
                  at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
                  at org.molecule.domain.MoleculeHome_$$_javassist_9.persist(MoleculeHome_$$_javassist_9.java)
                  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:174)
                  at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
                  at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                  at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                  at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                  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.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                  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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                  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)
                  Caused by: java.sql.BatchUpdateException: failed batch
                  at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
                  at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
                  at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
                  at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
                  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
                  ... 83 more
                  23:17:21,437 ERROR [ExceptionFilter] uncaught exception
                  javax.servlet.ServletException: Error calling action method of component with id molecule:save
                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                  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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                  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)
                  23:17:21,468 ERROR [ExceptionFilter] exception root cause
                  javax.faces.FacesException: Error calling action method of component with id molecule:save
                  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
                  at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                  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.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                  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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                  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)
                  Caused by: javax.faces.el.EvaluationException: /MoleculeEdit.xhtml @63,61 action="#{moleculeHome.persist}": javax.persistence.PersistenceException: org.hibernate.except
                  at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
                  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                  ... 43 more
                  Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
                  at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
                  at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:299)
                  at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:83)
                  at org.jboss.seam.framework.EntityHome.persist(EntityHome.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 org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                  at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                  at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
                  at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
                  at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
                  at org.molecule.domain.MoleculeHome_$$_javassist_9.persist(MoleculeHome_$$_javassist_9.java)
                  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:174)
                  at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
                  at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                  at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                  ... 44 more
                  Caused by: org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
                  at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
                  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
                  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
                  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
                  at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
                  at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
                  at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                  at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)
                  ... 77 more
                  Caused by: java.sql.BatchUpdateException: failed batch
                  at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
                  at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
                  at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
                  at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
                  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
                  ... 83 more
                  23:17:21,687 ERROR [DebugPageHandler] redirecting to debug page
                  java.sql.BatchUpdateException: failed batch
                  at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
                  at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
                  at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
                  at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
                  at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
                  at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
                  at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
                  at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
                  at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                  at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)
                  at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:83)
                  at org.jboss.seam.framework.EntityHome.persist(EntityHome.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 org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                  at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                  at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
                  at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
                  at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                  at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                  at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
                  at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
                  at org.molecule.domain.MoleculeHome_$$_javassist_9.persist(MoleculeHome_$$_javassist_9.java)
                  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:174)
                  at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
                  at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                  at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                  at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
                  at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                  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.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                  at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                  at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                  at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                  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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                  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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                  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)

                  • 6. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
                    ir vega Newbie

                    petemuir

                    That is precisely the sort of nudge we needed. I hope to have some more feedback soon. If we can get something up and running, I'll post it here but you can expect some more naive questions first.
                    I think we have a bit more of a learning curve to climb than we expected but I think it'll be worth it. Thanks.

                    javalars

                    Yes, 1.2.1 is getting us further than before too but I'm not sure we got as far as you seem to have. Did you change the seam gen'erated code to get so far?

                    Gavin & co

                    Did you change something to make this work better in 1.2.1 . It seems a bit far fetched to imagine this improvement was just a side-effect of fixing something totally unrelated! Anyway, I hope this feedback (especially from those who know more about it than myself) is useful.

                    • 7. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
                      Bengt Larsson Newbie

                      This helping us, thank so muche.

                      3) Create the relevant framework components (i.e. a entityquery for atoms and compounds, entityhome for molecule
                      4) Create a simple CRUD screen using a mixture of h:inputText, h:commandButton s:selectItems and s:convertEntity


                      To make "create new molecule" screen we defines entity-query in components.xml for use on selectone/selectitems for to let user select atom.
                      So, ofcourse(?) we need selectone/selectitems to return atom id (not Atom object - molecule entity have atom_id property) so moleculeHome can be persist new molecule. Is this what your meaning with s:convertEntity to convert user selectioned Atom object to a id (as java primitive "long")? Can some body show, of this, example please? How it is good to do?


                      • 8. Re: COMPOUNDs, ATOMs & MOLECULEs - don't try this at home!
                        ir vega Newbie

                        I manually coded my MoleculeHome (rather than create it by "config" in components.xml) so it can suck out the Atom object (and the Compound) from the context and get the id from the Atom object for use in the overridden persist.
                        I am not sure if this is a reasonable practice in seam but it seems to be a solution that works - but it does couple my Molecule's entity home to this particular use-case a bit (any comments).
                        Did you find another way or any best practice for this type of problem?