请教两个关于minidao的问题
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.Integerid */ @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.Integerid */ 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 * */@MiniDaopublic 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")@Transactionalpublic class WorkflowTemplateServiceImplextends CommonServiceImpl implements WorkflowTemplateServiceI { @Autowired privateWorkflowTemplateDao workflowTemplateDao; publicvoid save(WorkflowTemplateEntity workflowTemplateEntity) { workflowTemplateDao.saveByHiber(workflowTemplateEntity); }} 现在有两个问题,请帮忙解答:1. 调用workflowTemplateService.save(workflowTemplateEntity);,错误提示保存实体异常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:Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'miniDaoHiberCommonDao'defined in file:Cannot resolve reference to bean 'sessionFactory' while setting bean property'sessionFactory'; nested exception is一个帖子放不下,更多的错误信息我放在附件中
找到真正的原因了,两个错误都是由同一个问题引起的。在 3. 实体类名这步中,实体参数不能是Object类型。由于这个实体类是用工具自动生成的,一直没注意到这点。而spring-mvc-hibernate.xml中的配置应该是org.jeecgframework.web.activiti.entity.*
页:
[1]