6 Replies Latest reply on Apr 2, 2009 5:39 AM by Stefano Ferrante

    Custom HBM files.

    Stefano Ferrante Newbie

      Hi all,
      i'm looking for an help ,about configuring new mapping resources for Hibernate in JBPM.

      I'm using Jboss 4.2.2 GA and JBPM 3.3.1 GA with Oracle 10g.

      There is any example on how configure a new hbm.xml to use for my persistance?.

      I have some problems to create the PAR archive from eclipse because Eclipse seem have some problem to create output folders.
      It ignore all xml files copying in the bin folder only the image process ,and the class files.
      Ignoring gpd.xml -processdefinition.xml- all Hibernate configuration files.

      I'm looking for some example to understand where my custom hbm.xml files need to be mapped and where they have to stay to be loaded correctly.

      I tried adding them in the Hibernate.extra.cfg.xml, or directly in hibernate.cfg.xml, but the problem is that jbpm can't find the entity class mapped in the hbm.xml, in classpath. This is correct, the class is in the par archive, and is not deployed still.
      Have to deploy par file and entity classes apart?

      Any useful link will be appreciated :).

      Thanks in advance.

        • 1. Re: Custom HBM files.
          Ronald van Kuijk Master

          If hibernate is e.g. in the server lib directory, it can not see the classes in the par or even the war. So in that case, you indeed have to deploy them separately

          • 2. Re: Custom HBM files.
            Stefano Ferrante Newbie

            Before your reply,i done the test with entity class in a jar file and hbm.xml mapped in hibernate.cfg.xml in JBPM folder.
            Then deploying the process, that use that entity.
            This work perfectly,i got a double insert atm but perhaps could be another problem on my process definition :) i will investigate on it.

            and yes hibernate is inside server lib folder not in JBPM.

            can you help me about the hierarchy , that the archive must have?

            This is what i have atm in my archive.

            simple.par is the name of the archive.

            then there are 2 folders.

            classes with all packages from com. and so on.
            then another folder simple,that contains :

            where should be hibernate mappings files ?
            and i have to place my mapping reference for my custom hbm.file in the archive or always apart?.

            I want understand how have to be the structure of the par archive to get properly deployed, with more then one Hbm.xml too.

            I was looking for this on manuals and googling a bit, but i don't find nothing useful :) atm.

            • 3. Re: Custom HBM files.
              Stefano Ferrante Newbie

              Hi, i'm trying still to create custom hbm files under my process.
              But still can't deploy a process with embedded hbm files.

              I tried putting in the .par file both hibernate.extra.hbm and the hibernate.hbm.xml, but the error is always:

              2009-04-01 09:43:16,734 ERROR [STDERR] org.hibernate.MappingException: Unknown entity: com.sample.model.Code
              at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
              at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
              at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
              at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)
              at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)
              at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
              at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
              at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
              at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
              at com.sample.dao.CodeDAO.insertCode(CodeDAO.java:40)
              at com.sample.action.StoreHandler.execute(StoreHandler.java:24)
              at org.jbpm.graph.def.Action.execute(Action.java:129)
              at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
              at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
              at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
              at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
              at org.jbpm.graph.def.Node.enter(Node.java:371)
              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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
              at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
              at org.jbpm.graph.def.Transition.take(Transition.java:167)
              at org.jbpm.graph.def.Node.leave(Node.java:479)
              at org.jbpm.graph.node.StartState.leave(StartState.java:82)
              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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
              at org.jbpm.graph.def.Node_$$_javassist_49.leave(Node_$$_javassist_49.java)
              at org.jbpm.graph.exe.Token.signal(Token.java:223)
              at org.jbpm.graph.exe.Token.signal(Token.java:180)
              at org.jbpm.jsf.core.action.SignalActionListener.handleAction(SignalActionListener.java:56)
              at org.jbpm.jsf.core.impl.JbpmActionListenerWrapper.processAction(JbpmActionListenerWrapper.java:82)
              at javax.faces.event.ActionEvent.processListener(ActionEvent.java:77)
              at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:746)
              at javax.faces.component.UICommand.broadcast(UICommand.java:368)
              at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
              at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
              at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:595)

              I don't find a way to deploy a process with custom hbm files without modifying the hibernate.hbm.xml file under jbpm.

              Hibernate lib is under server folder lib (the common folder ) and under jbm atm.

              There is an option to deploy a process with custom hbm files without modifying the default hibernate.hbm.xml file under JBPM? i tried too adding only the hibernate.extra.hbm.xml file only in my process but nothing.

              in the manual at this link:

              at 7.8 and 7.9 there are some rows about how customize hibernate references, but seem that i need anyway to modify the hibernate.hbm.xml file, adding reference to my custom hbm files.

              So is impossible to deploy a new process,with some presistance classes, without modifying the file under jbpm?.

              Any suggestion will be appreciated.

              • 4. Re: Custom HBM files.
                Volker Börchers Newbie

                I was having the same kind of problem, see http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4219306.

                To resolve these classloading issues you have to ensure that the classloader that hibernate uses knows about (i.e. can load) your hbm.xml files and the entity classes. For now I resolved the classloading issues by placing these files under deploy/jbpm/jbpm-enterprise.jar/. Of course this is just a hack. A better solution should be packing everything into a single EAR.

                It might be possible to change the classloading to enable hibernate getting access to the par file's content. The Eclipse OSGI implementation has "Buddy Policy" to resolve similar issues (see http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements). This would be the best solution (since then the entities could be versioned too) but I think that it would require changes to the jBPM sources.


                • 5. Re: Custom HBM files.
                  Ronald van Kuijk Master

                  afaik, jBPM4 will support this. Not 100% sure though...

                  • 6. Re: Custom HBM files.
                    Stefano Ferrante Newbie

                    Thanks a lot forreply :) at last now is more clear :).