<br> It seems the docs need to be updated. Would you plz open a JIRA to fix the place you are seeing this info?<br><br> For more current info, take a look at this blog post, specially the end on "how to disable shadow facts":<br>
<br><a href="http://blog.athico.com/2008/02/shadow-facts-what-you-always-wanted-to.html">http://blog.athico.com/2008/02/shadow-facts-what-you-always-wanted-to.html</a><br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2008/4/2, Keith Bennett <<a href="mailto:forthwind@gmail.com">forthwind@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am currently using Drools to validate an extensive object graph.<br> When I validate a transient object graph (i.e., not persisted via<br> Hibernate) inside of a JUnit test method, validation occurs<br> successfully. However, when I retrieve the same object graph from<br>
Hibernate and subsequently validate it, I get the stack trace that<br> I've included below, but only when I use shadow proxies. When I turn<br> shadow proxies off, validation runs successfully against the persisted<br>
object graph again. Of course, I'm utilizing lazy association<br> fetching to improve performance and want to continue utilizing it.<br> Has anyone run into this same problem, and if so, were you able to<br> work around it without turning shadow proxies off? Before you ask, my<br>
Hibernate session is open before and after I invoke Drools to perform<br> validation in the same unit of work (i.e., transaction), so it's not<br> an issue of not having an active Hibernate session available (I've<br>
verified this through testing).<br> <br> One more thing. The user guide says that if shadow proxies are turned<br> off that modifyRetract() should be called before an object is modified<br> and modifyAssert() should be called after it is modifed. First, what<br>
is the method parameter to these two overloaded methods, Object or<br> FactHandle (both exist)? Second, I don't see modifyAssert() available<br> in the library, just modifyInsert(). Should the documentation change<br>
to read modifyInsert() instead of modifyAssert()? If so, again with<br> which parameter?<br> <br> I appreciate any insight you may have!<br> <br> Here's the stack trace:<br> <br> org.hibernate.LazyInitializationException: failed to lazily initialize<br>
a collection, no session or session was closed<br> at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)<br> at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)<br>
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)<br> at org.hibernate.collection.PersistentSet.addAll(PersistentSet.java:244)<br> at org.drools.util.ShadowProxyUtils.cloneObject(ShadowProxyUtils.java:76)<br>
at com.cbi.domain.loan.indirect.IndirectLoanShadowProxy.getCustomers(Unknown<br> Source)<br> at org.drools.base.com.cbi.domain.loan.indirect.IndirectLoan28409161$getCustomers.getValue(Unknown<br> Source)<br>
at org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:127)<br> at org.drools.rule.Declaration.getValue(Declaration.java:198)<br> at LoanValidationBusinessRules.Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.evaluate(Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.java:12)<br>
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)<br> at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)<br> at org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)<br>
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)<br> at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)<br> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)<br>
at org.drools.reteoo.Rete.assertObject(Rete.java:175)<br> at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)<br> at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)<br>
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)<br>
at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.executeRules(DroolsBusinessRulesServiceHelper.java:77)<br> at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.validate(DroolsBusinessRulesServiceHelper.java:66)<br>
at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceImpl.validate(DroolsBusinessRulesServiceImpl.java:97)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)<br> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)<br>
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)<br> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)<br>
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)<br> at $Proxy4.validate(Unknown Source)<br> at com.cbi.service.loan.indirect.impl.IndirectLoanManagementServiceImpl.submitForBooking(IndirectLoanManagementServiceImpl.java:680)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)<br> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)<br> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)<br> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)<br>
at $Proxy6.submitForBooking(Unknown Source)<br> at com.cbi.service.loan.indirect.impl.LoanManagementServiceImplTestCase.testSubmitLoanForBooking(LoanManagementServiceImplTestCase.java:116)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br>
at junit.framework.TestCase.runTest(TestCase.java:164)<br> at junit.framework.TestCase.runBare(TestCase.java:130)<br> at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)<br>
at junit.framework.TestResult$1.protect(TestResult.java:106)<br> at junit.framework.TestResult.runProtected(TestResult.java:124)<br> at junit.framework.TestResult.run(TestResult.java:109)<br> at junit.framework.TestCase.run(TestCase.java:120)<br>
at junit.framework.TestSuite.runTest(TestSuite.java:230)<br> at junit.framework.TestSuite.run(TestSuite.java:225)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)<br>
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)<br> at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)<br>
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)<br>
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)<br> 2008-04-02 16:48:32,691 ERROR<br> org.hibernate.LazyInitializationException - failed to lazily<br> initialize a collection, no session or session was closed<br>
org.hibernate.LazyInitializationException: failed to lazily initialize<br> a collection, no session or session was closed<br> at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)<br>
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)<br> at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)<br>
at org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)<br> at LoanValidationBusinessRules.Rule_A_Loan_must_have_at_least_one_Customer_0.eval0(Rule_A_Loan_must_have_at_least_one_Customer_0.java:38)<br>
at LoanValidationBusinessRules.Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.evaluate(Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.java:16)<br> at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)<br>
at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)<br> at org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)<br> at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)<br>
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)<br> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)<br> at org.drools.reteoo.Rete.assertObject(Rete.java:175)<br>
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)<br> at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)<br>
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)<br> at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.executeRules(DroolsBusinessRulesServiceHelper.java:77)<br>
at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.validate(DroolsBusinessRulesServiceHelper.java:66)<br> at com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceImpl.validate(DroolsBusinessRulesServiceImpl.java:97)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)<br> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)<br> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)<br> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)<br>
at $Proxy4.validate(Unknown Source)<br> at com.cbi.service.loan.indirect.impl.IndirectLoanManagementServiceImpl.submitForBooking(IndirectLoanManagementServiceImpl.java:680)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br>
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)<br> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)<br> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)<br>
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)<br> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)<br>
at $Proxy6.submitForBooking(Unknown Source)<br> at com.cbi.service.loan.indirect.impl.LoanManagementServiceImplTestCase.testSubmitLoanForBooking(LoanManagementServiceImplTestCase.java:116)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br>
at junit.framework.TestCase.runTest(TestCase.java:164)<br> at junit.framework.TestCase.runBare(TestCase.java:130)<br> at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)<br>
at junit.framework.TestResult$1.protect(TestResult.java:106)<br> at junit.framework.TestResult.runProtected(TestResult.java:124)<br> at junit.framework.TestResult.run(TestResult.java:109)<br> at junit.framework.TestCase.run(TestCase.java:120)<br>
at junit.framework.TestSuite.runTest(TestSuite.java:230)<br> at junit.framework.TestSuite.run(TestSuite.java:225)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)<br>
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)<br> at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)<br>
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br> at java.lang.reflect.Method.invoke(Method.java:585)<br> at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)<br>
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)<br> _______________________________________________<br> rules-users mailing list<br> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> </blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br>
Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>