cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti with Hibernate

cookie-exploit
Champ in-the-making
Champ in-the-making
Hello guys,

is it possible to use Activiti with hibernate instead of mybatis? And if it is possible, what I have to do to make it work?


Greetz cookie-exploit
11 REPLIES 11

cookie-exploit
Champ in-the-making
Champ in-the-making
It's important to know, what you want to do in a single Transaction. Because with my Method you start a Transaction with my Method and then all database manipulation will done in proxy objects, so that the real manipulation is done if you said commit.

You can think about using a transaction whenever you edit something. I use conversations to manage my transactions, but as a simple example you can start a new session for every "bean" you show, that is what I did with the conversations.

Examples:

1. You have an address book and then say to edit an contact. If you done this you create a new Transaction for the showed edit dialog and call commit if you save and rollback if you cancel the dialog or an error in the saving method occur.

2. You have an content management system and want to edit a file. If you start to edit something related to the file, you start an new transaction. Then you save the edited things, start the approve process, that the current state ist the "review" state. After that is done you can call commit to commit the changes you done with your objects and the activiti engine does with their objects. Remember that you had to call the save methods of your services to save your own objects, before you call commit.

I hope this examples helps you a bit! Smiley Happy



Greets cookie-exploit

nandoztx
Champ in-the-making
Champ in-the-making
Thanks for your patience!

The problem I have with the transaction is as follows: within a servieTask I'm doing a query with hibernate.
public void execute(DelegateExecution execution) throws Exception {
 
  Version version = versionService.findDistributionVersion("Test");
  System.err.println(version);
    }

and when I stress test with multiple simultaneous threads, I have a connection deadlock, because I do a query (using hibernate), it opens a new DB transaction and don't use the transaction that was already opened by Activiti.

It's possible I do this?

Thanks!