<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi ,kris ,thank you very much for your reply. I have orm.xml in META-INF folder.<BR>
Yesterday,i modified the persistence.xml to solve this problem like below:<BR>
&nbsp;<BR>
=================persistence.xml================<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="hibernate.max_fetch_depth" value="3"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT color=#ff0000>&lt;!--property name="hibernate.hbm2ddl.auto" value="create" /--&gt;<BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="hibernate.show_sql" value="true" /&gt;<BR>
&nbsp;<BR>
==================persistence.xml END==============<BR>
&nbsp;<BR>
I change the&nbsp; <FONT color=#ff0000>&lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; </FONT><FONT color=#000000>into comments,then </FONT><BR>
<FONT color=#000000>create the table in DB using the SQL:</FONT><BR>
========SQL========<BR>
<FONT color=#000000>create table Notification_EmailNotificationHeader<BR>&nbsp;(Notification_id numeric(19,0) not null, emailHeaders_id numeric(19,0) not<BR>null, mapkey varchar(255) <FONT color=#ff0000>not null</FONT>, primary key (Notification_id, mapkey),&nbsp;unique (emailHeaders_id))</FONT><BR>
&nbsp;<BR>
=====SQL END========<BR>
&nbsp;<BR>
it works ok now~<BR>
&nbsp;<BR>
but i want to know where the SQL "creat table……" defined?<BR>
<BR>&nbsp;&nbsp;<BR>&gt; From: kris.verlaenen@cs.kuleuven.be<BR>&gt; To: rules-users@lists.jboss.org<BR>&gt; Date: Tue, 27 Jul 2010 14:32:37 +0200<BR>&gt; Subject: Re: [rules-users] Exception when use Human Task<BR>&gt; <BR>&gt; It doesn't seem to be able to find a query, which should be defined in the <BR>&gt; orm.xml. Do you have the orm.xml file in your META-INF folder on your <BR>&gt; classpath?<BR>&gt; http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-process/drools-process-task/src/main/resources/META-INF/orm.xml<BR>&gt; <BR>&gt; Kris<BR>&gt; <BR>&gt; ----- Original Message ----- <BR>&gt; From: "XiaoMiTang" &lt;dingyongchang@hotmail.com&gt;<BR>&gt; To: &lt;rules-users@lists.jboss.org&gt;<BR>&gt; Sent: Tuesday, July 27, 2010 11:06 AM<BR>&gt; Subject: [rules-users] Exception when use Human Task<BR>&gt; <BR>&gt; <BR>&gt; &gt;<BR>&gt; &gt; I got an exception when using Human Task ,caused by the following code:<BR>&gt; &gt;<BR>&gt; &gt; ===============code===========<BR>&gt; &gt; EntityManagerFactory emf = Persistence.createEntityManagerFactory("aaaa");<BR>&gt; &gt; TaskService taskService = new<BR>&gt; &gt; TaskService(emf,SystemEventListenerFactory.getSystemEventListener());<BR>&gt; &gt; ===============code end=======<BR>&gt; &gt;<BR>&gt; &gt; the error info in the Eclipse's Console llike this:<BR>&gt; &gt; ===========error info=====<BR>&gt; &gt; 严重: Unsuccessful: create table Notification_EmailNotificationHeader<BR>&gt; &gt; (Notification_id numeric(19,0) not null, emailHeaders_id numeric(19,0) not<BR>&gt; &gt; null, mapkey varchar(255) null, primary key (Notification_id, mapkey),<BR>&gt; &gt; unique (emailHeaders_id))<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create<BR>&gt; &gt; 严重: 无法在表 'Notification_EmailNotificationHeader' 中可为 Null 的列上定义 PRIMARY KEY<BR>&gt; &gt; 约束。<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create<BR>&gt; &gt; 严重: Unsuccessful: alter table Notification_EmailNotificationHeader add<BR>&gt; &gt; 
constraint FK92169CC0379F97EA foreign key (emailHeaders_id) references<BR>&gt; &gt; EmailNotificationHeader<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create<BR>&gt; &gt; 严重: 找不到对象 "Notification_EmailNotificationHeader",因为它不存在或者您没有所需的权限。<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create<BR>&gt; &gt; 严重: Unsuccessful: alter table Notification_EmailNotificationHeader add<BR>&gt; &gt; constraint FK92169CC01B1E66DC foreign key (Notification_id) references<BR>&gt; &gt; Notification<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create<BR>&gt; &gt; 严重: 找不到对象 "Notification_EmailNotificationHeader",因为它不存在或者您没有所需的权限。<BR>&gt; &gt; 2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport execute<BR>&gt; &gt; 信息: schema export complete<BR>&gt; &gt; java.lang.IllegalArgumentException: Named query not found:<BR>&gt; &gt; UnescalatedDeadlines<BR>&gt; &gt; at<BR>&gt; &gt; org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)<BR>&gt; &gt; at org.drools.task.service.TaskService.&lt;init&gt;(TaskService.java:65)<BR>&gt; &gt; at org.drools.task.service.TaskService.&lt;init&gt;(TaskService.java:48)<BR>&gt; &gt; at com.demo.action.loginController.HumanTask(loginController.java:94)<BR>&gt; &gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<BR>&gt; &gt; at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<BR>&gt; &gt; at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<BR>&gt; &gt; at java.lang.reflect.Method.invoke(Unknown Source)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:174)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.mvc.annotatio
n.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)<BR>&gt; &gt; at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)<BR>&gt; &gt; at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)<BR>&gt; &gt; at<BR>&gt; &gt; org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.catalina
.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)<BR>&gt; &gt; at<BR>&gt; &gt; org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)<BR>&gt; &gt; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)<BR>&gt; &gt; at java.lang.Thread.run(Unknown Source)<BR>&gt; &gt; =======error info end===============================================<BR>&gt; &gt;<BR>&gt; &gt; the top error info(chinese text) means that:<BR>&gt; &gt; [mapkey] is nullable, it can not be defined as primary key ;<BR>&gt; &gt;<BR>&gt; &gt; how to slove it?<BR>&gt; &gt; Thansks~<BR>&gt; &gt; -- <BR>&gt; &gt; View this message in context: <BR>&gt; &gt; http://drools-java-rules-engine.46999.n3.nabble.com/Exception-when-use-Human-Task-tp998703p998703.html<BR>&gt; &gt; Sent from the Drools - User mailing list archive at Nabble.com.<BR>&gt; &gt;<BR>&gt; &gt; _______________________________________________<BR>&gt; &gt; rules-users mailing list<BR>&gt; &gt; rules-users@lists.jboss.org<BR>&gt; &gt; https://lists.jboss.org/mailman/listinfo/rules-users<BR>&gt; &gt; <BR>&gt; <BR>&gt; <BR>&gt; Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<BR>&gt; _______________________________________________<BR>&gt; rules-users mailing list<BR>&gt; rules-users@lists.jboss.org<BR>&gt; https://lists.jboss.org/mailman/listinfo/rules-users<BR>                                               <br /><hr />Hotmail: Powerful Free email with security by Microsoft. <a href='https://signup.live.com/signup.aspx?id=60969' target='_new'>Get it now.</a></body>
</html>