0

我正在尝试制作一个基于spring mvc和hibernate的drools应用程序。

EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.task");   
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
TaskService taskService = new TaskService(emf, systemEventListener);

TaskServiceSession taskSession = taskService.createSession();
taskSession.addUser(new User("Administrator"));
taskSession.addUser(new User("Myuser"));// can be set to logged in user at runtime

MinaTaskServer server = new MinaTaskServer(taskService);
Thread thread = new Thread(server);
thread.start();

ksession.getWorkItemManager().registerWorkItemHandler("Log",humanTaskHandler);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wsHumanTaskHandler);

 KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// start a new process instance
ksession.startProcess("HumanTaskSample");

做什么createEntityManagerFactory?它会从数据库中删除我所有的表并每次都创建一个新表吗?

因为在我的任务表中,每次它只包含一行?

为什么??

提前致谢。

4

1 回答 1

0

您的项目中有persistence.xml文件,其中包含行

<persistence-unit name="org.drools.task">   

你的桌子被丢掉了,因为你有下一个财产persistence.xml

<property name="hibernate.hbm2ddl.auto" value="create-drop"/>    

create-drop意思是:在会话结束时删除模式

将值更改为validateupdate

于 2012-11-06T10:56:58.160 回答