[rules-users] Design Question

Daniel Miller dmiller at versatile.com
Fri Nov 6 11:11:58 EST 2009


Hey everyone,

So I'm faced with a slight dilemma here.  I have a slew of database  
entities managed by Hibernate.  I also have remote object layer, which  
I use for the UI, which are basic clones of the database entities.  I  
did this to prevent the UI from experiencing  
LazyInitializationException's.

I was trying to use my remote layer in Drools, pushing all my remote  
objects into the Working Memory, but I get LazyInit Exceptions when  
trying to convert back into a db object (in a WorkItemHandler instance).

Is there anyway that I can tell Spring, or Drools, that the working  
memory is transactional?  I suspect that  my work item handler, though  
wired in Spring with the appropriate service classes, loses it's  
transactional state when it gets pushed into the working memory.  Is  
that a true assumption?  And if so, is there a way that I can keep  
that transactional state in the WorkItemHandler instance?

I've seen the examples where people will push a hibernateSession in as  
a global, but I would like to avoid pushing my Dao classes in like  
this.  I'd prefer to either push my service layer in as globals (since  
they use the daos) or somehow the working memory in so it has a  
session in Spring.

Hope this all makes sense.

Dan Miller



More information about the rules-users mailing list