0 Replies Latest reply on Dec 5, 2006 5:57 PM by Juan Giovanolli

    new task type using hibernate annotations

    Juan Giovanolli Newbie

      i'm trying to create a new node type. for this i'm doing this

      
      package com.santex.darwin.core.workflow;
      
      import java.util.Set;
      
      import javax.persistence.DiscriminatorValue;
      import javax.persistence.Entity;
      
      import org.jbpm.graph.def.Node;
      
      
      /**
       *
       * @author Juan Giovanolli
       * 04/12/2006
       */
      @Entity(name = "activitydefinition")
      @DiscriminatorValue("Z")
      public class ActivityDefinition extends Node
      {
      
      
      
      
       private String description;
       private WorkType workType;
       private boolean timeReportRequired;
       private TeamType workingTeamType;
       private PlanificationType planType;
       private EstimationType estimationType;
      
       private Set<Transition> possibleFlows;
      
       /**
       * @return the description
       */
       public String getDescription()
       {
       return description;
       }
       /**
       * @param pDescription the description to set
       */
       public void setDescription(final String pDescription)
       {
       description = pDescription;
       }
       /**
       * @return the estimationType
       */
       public EstimationType getEstimationType()
       {
       return estimationType;
       }
       /**
       * @param pEstimationType the estimationType to set
       */
       public void setEstimationType(final EstimationType pEstimationType)
       {
       estimationType = pEstimationType;
       }
      
       /**
       * @return the planType
       */
       public PlanificationType getPlanType()
       {
       return planType;
       }
       /**
       * @param pPlanType the planType to set
       */
       public void setPlanType(final PlanificationType pPlanType)
       {
       planType = pPlanType;
       }
       /**
       * @return the possibleFlows
       */
       public Set<Transition> getPossibleFlows()
       {
       return possibleFlows;
       }
       /**
       * @param pPossibleFlows the possibleFlows to set
       */
       public void setPossibleFlows(final Set<Transition> pPossibleFlows)
       {
       possibleFlows = pPossibleFlows;
       }
       /**
       * @return the timeReportRequired
       */
       public boolean isTimeReportRequired()
       {
       return timeReportRequired;
       }
       /**
       * @param pTimeReportRequired the timeReportRequired to set
       */
       public void setTimeReportRequired(final boolean pTimeReportRequired)
       {
       timeReportRequired = pTimeReportRequired;
       }
       /**
       * @return the workingTeamType
       */
       public TeamType getWorkingTeamType()
       {
       return workingTeamType;
       }
       /**
       * @param pWorkingTeamType the workingTeamType to set
       */
       public void setWorkingTeamType(final TeamType pWorkingTeamType)
       {
       workingTeamType = pWorkingTeamType;
       }
       /**
       * @return the workType
       */
       public WorkType getWorkType()
       {
       return workType;
       }
       /**
       * @param pWorkType the workType to set
       */
       public void setWorkType(final WorkType pWorkType)
       {
       workType = pWorkType;
       }
      
       ////////////////////////////////////
      
      
      }
      
      



      Notice that i'm using annotations for declare the new node type. When i'm trying to deploy the project, i'm getting the error below:

      18:58:56,390 INFO [TomcatDeployer] undeploy, ctxPath=/darwin, warUrl=.../tmp/deploy/tmp20419darwin.ear-contents/darwin-exp.war/
      18:58:56,406 INFO [SessionFactoryImpl] closing
      18:58:56,406 INFO [DriverManagerConnectionProvider] cleaning up connection pool: jdbc:mysql://localhost:3306/darwinapp
      18:58:56,531 INFO [EARDeployer] Undeploying J2EE application, destroy step: file:/C:/jboss-4.0.5.GA/server/default/deploy/darwin.ear
      18:58:56,531 INFO [EARDeployer] Undeployed J2EE application: file:/C:/jboss-4.0.5.GA/server/default/deploy/darwin.ear
      18:58:56,546 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.5.GA/server/default/deploy/darwin.ear
      18:58:57,796 INFO [Ejb3Deployment] EJB3 deployment time took: 109
      18:58:58,453 INFO [Ejb3Deployment] EJB3 deployment time took: 657
      18:58:58,468 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=darwin.ear,unitName=darwin with dependencies:
      18:58:58,468 INFO [JmxKernelAbstraction] jboss.jca:name=darwinDatasource,service=DataSourceBinding
      18:58:58,484 INFO [Ejb3Configuration] found EJB3 Entity bean: com.santex.darwin.core.model.AppUser
      18:58:58,484 INFO [Ejb3Configuration] found EJB3 @MappedSuperclass: com.santex.darwin.core.model.BaseObject
      18:58:58,484 INFO [Ejb3Configuration] found EJB3 Entity bean: com.santex.darwin.core.model.Role
      18:58:58,484 INFO [Ejb3Configuration] found EJB3 Entity bean: com.santex.darwin.core.workflow.ActivityDefinition
      18:58:58,500 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      18:58:58,515 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
      18:58:58,515 INFO [Ejb3Configuration] [PersistenceUnit: darwin] no META-INF/orm.xml found
      18:58:58,515 INFO [AnnotationBinder] Binding entity from annotated class: com.santex.darwin.core.model.AppUser
      18:58:58,515 INFO [EntityBinder] Bind entity com.santex.darwin.core.model.AppUser on table app_user
      18:58:58,531 INFO [AnnotationBinder] Binding entity from annotated class: com.santex.darwin.core.model.Role
      18:58:58,531 INFO [EntityBinder] Bind entity com.santex.darwin.core.model.Role on table role
      18:58:58,531 INFO [AnnotationBinder] Binding entity from annotated class: com.santex.darwin.core.workflow.ActivityDefinition
      18:58:58,531 INFO [EntityBinder] Bind entity com.santex.darwin.core.workflow.ActivityDefinition on table activitydefinition
      18:58:58,562 WARN [ServiceController] Problem starting service persistence.units:ear=darwin.ear,unitName=darwin
      org.hibernate.AnnotationException: No identifier specified for entity: com.santex.darwin.core.workflow.ActivityDefinition
       at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:626)
       at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1207)
       at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:844)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:382)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
       at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
       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.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor201.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy287.start(Unknown Source)
       at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:96)
       at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:467)
       at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:317)
       at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor201.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy93.start(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
       at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
       at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
       at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
       at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy94.start(Unknown Source)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      



      in my opinion, this error is generated because isn't matching correctly the hbm.xml needed to persist the Node class.


      in summary, it is possible to inherit the persistence declared in hbm.xml from annotations? how?