Hi!

>JESS doesn't inherently possess transaction support.

I've implemented a package called Java Object Transaction Service (JOTS),
which is based on the CORBA Object Transaction Service. Currently, only
local transactions are supported, i.e., the transactional objects plus the
transaction coordinator all reside in the same Java process.

Jess integration is achieved via a Userpackage providing the following
functions:

1) (jots-current-begin) - begin a new transaction
2) (jots-current-commit) - commit current transaction
3) (jots-current-rollback) - rollback current transaction
4) (jots-current) - return current transaction context

Below is a sample showing how to use these functions. The (state-create)
function will eventually call the Java connector that creates a record in
the database for the given fact. The connectors (in this simple example
it's only one) are automatically registered with the transaction
coordinator.

(deffunction create-emp-in-new-dept (?empno ?ename ?deptno ?dname)
  ;; Begin a new transaction
  (try
   (jots-current-begin)
   catch
   (return FALSE))

  ;; Perform transactional operations
  (try
   (state-create (assert (scott-dept (deptno ?deptno) (dname ?dname))))
   (state-create (assert (scott-emp
                           (empno ?empno) (ename ?ename)
                           (deptno ?deptno))))

   ;; Commit changes
   (bind ?result (jots-current-commit))

   catch

   (bind ?result FALSE)
   (jots-current-rollback))

  (return ?result))


Greetings

Thomas

________________________________

Dipl.-Inform. Thomas Barnekow
Fraunhofer IAO, Competence Center Software Technology
                                               
 mail:   Nobelstra�e 12, D-70569 Stuttgart,    
         Germany                               
                                               
 phone:  +49 (0) 711 / 970 - 2346              
                                               
 fax:    +49 (0) 711 / 970 - 2300              
                                               
 mobile: +49 (0) 172 / 7126018                 
                                               
 email:  [EMAIL PROTECTED]            
                                               
 web:    http://www.swt.iao.fhg.de             
                                               




---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to