1. 使用jeecg3.4.3版本 2. 包名: 3. 实体类名 packageorg.jeecgframework.web.activiti.entity.workflow; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; importorg.hibernate.annotations.DynamicInsert; importorg.hibernate.annotations.DynamicUpdate; importorg.hibernate.annotations.GenericGenerator; /** *@Title: Entity *@Description: 模板 *@author *@date 2014-05-05 19:58:31 *@version V1.0 * */ @Entity @Table(name ="workflow_template", schema = "") @DynamicUpdate(true) @DynamicInsert(true) @SuppressWarnings("serial") public class WorkflowTemplateEntityimplements java.io.Serializable { /**id*/ privatejava.lang.Integer id; /**流程定义ID*/ privatejava.lang.String deploymentId; /**模版内容*/ privatejava.lang.Object content; /** *方法: 取得java.lang.Integer *@return: java.lang.Integer id */ @Id @GeneratedValue(generator= "paymentableGenerator") @GenericGenerator(name= "paymentableGenerator", strategy = "uuid") @Column(name="ID",nullable=false,precision=19,scale=0) publicjava.lang.Integer getId(){ returnthis.id; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer id */ publicvoid setId(java.lang.Integer id){ this.id= id; } /** *方法: 取得java.lang.String *@return: java.lang.String 流程定义ID */ @Column(name="DEPLOYMENT_ID",nullable=true,length=64) publicjava.lang.String getDeploymentId(){ returnthis.deploymentId; } /** *方法: 设置java.lang.String *@param: java.lang.String 流程定义ID */ publicvoid setDeploymentId(java.lang.String deploymentId){ this.deploymentId= deploymentId; } /** *方法: 取得java.lang.Object *@return: java.lang.Object 模版内容 */ @Column(name="CONTENT",nullable=true) publicjava.lang.Object getContent(){ returnthis.content; } /** *方法: 设置java.lang.Object *@param: java.lang.Object 模版内容 */ publicvoid setContent(java.lang.Object content){ this.content= content; } } 4. Spring-mindao.xml中配置: 5. spring-mvc-hibernate.xml中配置: 6. WorkflowTemplateDao.java代码: packageorg.jeecgframework.web.activiti.dao.workflow; import java.util.List; importorg.jeecgframework.web.activiti.entity.workflow.WorkflowTemplateEntity; importorg.jeecgframework.minidao.annotation.Arguments; importorg.jeecgframework.minidao.annotation.MiniDao; importorg.jeecgframework.minidao.hibernate.MiniDaoSupportHiber; /** *Minidao例子 *@author fancq * */ @MiniDao public interface WorkflowTemplateDaoextends MiniDaoSupportHiber<WorkflowTemplateEntity> { } 7. WorkflowTemplateServiceImpl.java代码 packageorg.jeecgframework.web.activiti.service.impl.workflow; import java.util.List; importorg.springframework.beans.factory.annotation.Autowired; importorg.springframework.stereotype.Service; importorg.springframework.transaction.annotation.Transactional; importorg.jeecgframework.core.common.service.impl.CommonServiceImpl; importorg.jeecgframework.web.activiti.dao.workflow.WorkflowTemplateDao; importorg.jeecgframework.web.activiti.entity.workflow.WorkflowTemplateEntity; importorg.jeecgframework.web.activiti.service.workflow.WorkflowTemplateServiceI; @Service("workflowTemplateService") @Transactional public class WorkflowTemplateServiceImplextends CommonServiceImpl implements WorkflowTemplateServiceI { @Autowired privateWorkflowTemplateDao workflowTemplateDao; publicvoid save(WorkflowTemplateEntity workflowTemplateEntity) { workflowTemplateDao.saveByHiber(workflowTemplateEntity); } } 现在有两个问题,请帮忙解答: 1. 调用workflowTemplateService.save(workflowTemplateEntity);,错误提示 [org.jeecgframework.minidao.hibernate.dao.impl.GenericBaseCommonDao]保存实体异常 org.hibernate.MappingException: Unknownentity: org.jeecgframework.web.activiti.entity.workflow.WorkflowTemplateEntity atorg.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:1141) atorg.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1433) atorg.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:116) atorg.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:206) atorg.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55) at 2. 如果spring-mvc-hibernate.xml中配置改为如下: 错误提示: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'miniDaoHandler' definedin file[E:\workspace-sts-3.4.0.RELEASE\jeecg-framework\target\classes\spring-minidao.xml]:Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'miniDaoHiberCommonDao'defined in file[E:\workspace-sts-3.4.0.RELEASE\jeecg-framework\target\classes\spring-minidao.xml]:Cannot resolve reference to bean 'sessionFactory' while setting bean property'sessionFactory'; nested exception is
|