JBoss中的Hibernate流口水

时间:2013-11-06 11:38:09

标签: hibernate jboss

使用hibernate时,规则显示以下错误

  

[22,22]:[ERR 102]第22:22行不匹配输入'FROM'期待'('in   模式联系中的“名称”规则

我正在插入:

static SessionFactory sessionFactory = null;
static{
    sessionFactory = new Configuration().configure().buildSessionFactory();
}
session =sessionFactory.openSession();
ksession.setGlobal("hibernateSession", session);

在插入规则之前,我将drools添加到知识构建器

package drools
//list any import classes here.
import droolsexec.Contact;
//declare any global variables here
global org.hibernate.Session hibernateSession;
rule "Name"
dialect "java" 
when
// message: Message( status =="GOODBYE" )
contact: Contact from hibernateSession.createQuery("from Contact").list();
then
System.out.println( contact.getFirstName()); 
end

1 个答案:

答案 0 :(得分:1)

我认为Contact中的括号是必需的,因为:

when
    contact: Contact() from ...
then
    ...