Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Environment env = KnowledgeBaseFactory.newEnvironment();
- env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, Persistence
- .createEntityManagerFactory("org.drools.persistence.jpa"));
- env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices
- .getTransactionManager());
- Properties ruleAgentProps = loadRuleAgentProperties();
- KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory
- .newKnowledgeBuilderConfiguration(ruleAgentProps, null);
- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
- .newKnowledgeBuilder(config);
- kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl"),
- ResourceType.DRL);
- KnowledgeBuilderErrors errors = kbuilder.getErrors();
- if (errors.size() > 0) {
- for (KnowledgeBuilderError error : errors) {
- System.err.println(error);
- }
- throw new IllegalArgumentException("Could not parse knowledge.");
- }
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
- StatefulKnowledgeSession ksession = JPAKnowledgeService
- .newStatefulKnowledgeSession(kbase, null, env);
- KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory
- .newFileLogger(ksession, "test");
- UserTransaction ut = (UserTransaction) new InitialContext()
- .lookup("java:comp/UserTransaction");
- ut.begin();
- Account account = new Account();
- account.setBalance(80);
- ksession.insert(account);
- ksession.fireAllRules();
- logger.close();
- ut.commit();
- ####################################################
- rule "basic rule"
- when
- Account( balance < 100 ) // condition
- then
- System.out.println("Account balance is " +
- "less than 100"); // consequence
- end
- ####################################################
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.Version <clinit>
- INFO: Hibernate Annotations 3.4.0.GA
- 03/05/2010 10:17:38 org.hibernate.cfg.Environment <clinit>
- INFO: Hibernate 3.3.0.SP1
- 03/05/2010 10:17:38 org.hibernate.cfg.Environment <clinit>
- INFO: hibernate.properties not found
- 03/05/2010 10:17:38 org.hibernate.cfg.Environment buildBytecodeProvider
- INFO: Bytecode provider name : javassist
- 03/05/2010 10:17:38 org.hibernate.cfg.Environment <clinit>
- INFO: using JDK 1.4 java.sql.Timestamp handling
- 03/05/2010 10:17:38 org.hibernate.annotations.common.Version <clinit>
- INFO: Hibernate Commons Annotations 3.1.0.GA
- 03/05/2010 10:17:38 org.hibernate.ejb.Version <clinit>
- INFO: Hibernate EntityManager 3.4.0.GA
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.QueryBinder bindQuery
- INFO: Binding Named query: ProcessInstancesWaitingForEvent => select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo where :type in elements(processInstanceInfo.eventTypes)
- 03/05/2010 10:17:38 org.hibernate.cfg.AnnotationBinder bindClass
- INFO: Binding entity from annotated class: org.drools.persistence.session.SessionInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.EntityBinder bindTable
- INFO: Bind entity org.drools.persistence.session.SessionInfo on table SessionInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.AnnotationBinder bindClass
- INFO: Binding entity from annotated class: org.drools.persistence.processinstance.ProcessInstanceInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.EntityBinder bindTable
- INFO: Bind entity org.drools.persistence.processinstance.ProcessInstanceInfo on table ProcessInstanceInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.AnnotationBinder bindClass
- INFO: Binding entity from annotated class: org.drools.persistence.processinstance.ProcessInstanceEventInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.EntityBinder bindTable
- INFO: Bind entity org.drools.persistence.processinstance.ProcessInstanceEventInfo on table ProcessInstanceEventInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.AnnotationBinder bindClass
- INFO: Binding entity from annotated class: org.drools.persistence.processinstance.WorkItemInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.annotations.EntityBinder bindTable
- INFO: Bind entity org.drools.persistence.processinstance.WorkItemInfo on table WorkItemInfo
- 03/05/2010 10:17:38 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
- INFO: Hibernate Validator not found: ignoring
- 03/05/2010 10:17:38 org.hibernate.cfg.search.HibernateSearchEventListenerRegister enableHibernateSearch
- INFO: Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
- 03/05/2010 10:17:38 org.hibernate.connection.DriverManagerConnectionProvider configure
- INFO: Using Hibernate built-in connection pool (not for production use!)
- 03/05/2010 10:17:38 org.hibernate.connection.DriverManagerConnectionProvider configure
- INFO: Hibernate connection pool size: 20
- 03/05/2010 10:17:38 org.hibernate.connection.DriverManagerConnectionProvider configure
- INFO: autocommit mode: true
- 03/05/2010 10:17:38 org.hibernate.connection.DriverManagerConnectionProvider configure
- INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/drools
- 03/05/2010 10:17:38 org.hibernate.connection.DriverManagerConnectionProvider configure
- INFO: connection properties: {user=root, password=****, autocommit=true, release_mode=auto}
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: RDBMS: MySQL, version: 5.1.45-community
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.12 ( Revision: ${bzr.revision-id} )
- 03/05/2010 10:17:39 org.hibernate.dialect.Dialect <init>
- INFO: Using dialect: org.hibernate.dialect.MySQLDialect
- 03/05/2010 10:17:39 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
- INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
- 03/05/2010 10:17:39 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
- INFO: instantiating TransactionManagerLookup: org.hibernate.transaction.BTMTransactionManagerLookup
- 03/05/2010 10:17:39 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
- INFO: instantiated TransactionManagerLookup
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Automatic flush during beforeCompletion(): disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Automatic session close at end of transaction: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: JDBC batch size: 15
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: JDBC batch updates for versioned data: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Scrollable result sets: enabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: JDBC3 getGeneratedKeys(): enabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Connection release mode: auto
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Maximum outer join fetch depth: 2
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Default batch fetch size: 1
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Generate SQL with comments: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Order SQL updates by primary key: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Order SQL inserts for batching: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
- INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
- 03/05/2010 10:17:39 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
- INFO: Using ASTQueryTranslatorFactory
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Query language substitutions: {}
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: JPA-QL strict compliance: enabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Second-level cache: enabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Query cache: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory createRegionFactory
- INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Optimize cache for minimal puts: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Structured second-level cache entries: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Statistics: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Deleted entity synthetic identifier rollback: disabled
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Default entity-mode: pojo
- 03/05/2010 10:17:39 org.hibernate.cfg.SettingsFactory buildSettings
- INFO: Named query checking : enabled
- 03/05/2010 10:17:39 org.hibernate.impl.SessionFactoryImpl <init>
- INFO: building session factory
- 03/05/2010 10:17:39 org.hibernate.impl.SessionFactoryObjectFactory addInstance
- INFO: Not binding factory to JNDI, no JNDI name configured
- 03/05/2010 10:17:39 org.hibernate.tool.hbm2ddl.SchemaExport execute
- INFO: Running hbm2ddl schema export
- 03/05/2010 10:17:39 org.hibernate.tool.hbm2ddl.SchemaExport execute
- INFO: exporting generated schema to database
- 03/05/2010 10:17:39 org.hibernate.tool.hbm2ddl.SchemaExport execute
- INFO: schema export complete
- 03/05/2010 10:17:39 bitronix.tm.BitronixTransactionManager logVersion
- INFO: Bitronix Transaction Manager version 1.3.3
- 03/05/2010 10:17:39 bitronix.tm.Configuration buildServerIdArray
- WARNING: cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!).
- 03/05/2010 10:17:39 bitronix.tm.Configuration buildServerIdArray
- INFO: JVM unique ID: <10.178.27.40>
- 03/05/2010 10:17:39 bitronix.tm.journal.DiskJournal open
- WARNING: active log file is unclean, previous server crash ?
- 03/05/2010 10:17:39 bitronix.tm.recovery.Recoverer run
- INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) [] (restricted to serverId '10.178.27.40')
- 03/05/2010 10:17:39 org.hibernate.impl.SessionFactoryImpl buildCurrentSessionContext
- WARNING: JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()
- 03/05/2010 10:17:42 org.hibernate.ejb.AbstractEntityManagerImpl joinTransaction
- WARNING: Calling joinTransaction() on a non JTA EntityManager
- 03/05/2010 10:17:42 bitronix.tm.twopc.Preparer prepare
- WARNING: executing transaction with 0 enlisted resource
- 03/05/2010 10:17:42 org.hibernate.ejb.AbstractEntityManagerImpl joinTransaction
- WARNING: Calling joinTransaction() on a non JTA EntityManager
- 03/05/2010 10:17:42 org.hibernate.ejb.AbstractEntityManagerImpl joinTransaction
- WARNING: Calling joinTransaction() on a non JTA EntityManager
- Account balance is less than 100
- 03/05/2010 10:17:42 bitronix.tm.twopc.Preparer prepare
- WARNING: executing transaction with 0 enlisted resource
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement