dataService.save (entity); / / PO, "inser t values (,)" occured.
logger.debug ("save entity: {}", entity);
entity.setProcessInstanceId (processInstanceId);
dataService.saveOrUpdate (entity); / / No "update t set ..."
which , dataService realized HibernateOperations ( inherited HibernateTemplate)
seeking guidance , seeking literacy .
------ Solution ---------------------------------------- ----
first look at whether the transaction in question , and then check the corresponding relationship with the entity table
------ Solution ----------------- ---------------------------
statement output came not necessarily perform the way . .
affairs , then see you do not have to open , or configure no, no positive execution unsuccessful
------ Solution -------------- ------------------------------
dataService.flush (); no phrase , your object or transient state , plus from transient to persistent state of the.
------ For reference only -------------------------------------- -
code:
dataService.save (entity); / / VO ---> PO ---> DO?, "inser t values (,)" ; occured.
logger.debug ("save entity: {}", entity);
entity.setProcessInstanceId (processInstanceId);
dataService.update (entity); / / No "update t set ..."
dataService.flush () ;/ / fixed! but not expected. please help me.
which , dataService realized HibernateOperations ( inherited HibernateTemplate)
give points , knot stickers. Seeking to come .
------ For reference only -------------------------------------- -
Thank you .
I ask, how can we see "Transaction Status" ?
I personally think that the correspondence table and the entity is not a problem , because the call
dataService.flush () method, you can print out a statement in line with expectations :
Hibernate: update be.oa_leave set PROCESS_INSTANCE_ID =? where ID =?
------ For reference only ---------------------------------- -----
Yes, the statement output only indicates that the database hits, and transaction commit does nothing.
However, the current transaction has been submitted to determine .
test data:
(mysql> select * from oa_leave;
+ ---- + --------------------- + --------- + -------- ------------- + --------------------- + ------------ + - --------------------------- + -------
-------------- + --------------------- + --------- ------------ +
| ID | PROCESS_INSTANCE_ID | USER_ID | START_TIME | END_TIME ; | LEAVE_TYPE | REASON ; | APPLY_
TIME | REALITY_START_TIME | REALITY_END_TIME |
+ ---- + --------------------- + --------- + -------- ------------- + --------------------- + ------------ + - --------------------------- + -------
-------------- + --------------------- + --------- ------------ +
| 1 | NULL | admin ; | 2013-09-06 08:30:00 | 2013-09-06 17:30:00 | leave ; | test Activiti process | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 2 | NULL | admin ; | 2013-09-05 08:30:10 | 2013-09-05 17:30:00 | leave ; | test Activiti Engine | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 3 | NULL | admin ; | 2013-09-05 18:06:50 | 2013-09-05 18:06:50 | leave ; | test leave | 0000 -0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 4 | NULL | admin ; | 2013-09-05 18:27:30 | 2013-09-05 18:27:30 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 5 | NULL | admin ; | 2013-09-05 18:41:19 | 2013-09-05 18:41:19 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 6 | NULL | admin ; | 2013-09-05 18:43:48 | 2013-09-05 18:43:48 | leave ; | test - entity process data is not synchronized | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 7 | NULL | admin ; | 2013-09-05 19:08:09 | 2013-09-05 19:08:09 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 8 | NULL | admin ; | 2013-09-06 08:40:24 | 2013-09-06 08:40:25 | days off | testing workflow engine | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 9 | NULL | admin ; | 2013-09-06 09:08:02 | 2013-09-06 09:08:02 | leave ; | test:
data is not synchronized | 0000-00-00 00:00:00 | 0000-00 -00 00:00:00 | 0000-00-00 00:00:00 |
| 10 | NULL | admin ; | 2013-09-06 09:38:50 | 2013-09-06 09:38:50 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 11 | NULL | admin ; | 2013-09-06 10:07:26 | 2013-09-06 10:07:26 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 12 | 2205 | admin ; | 2013-09-06 11:21:49 | 2013-09-06 11:21:49 | leave ; | test ; | 2013-0
9-06 11:21:56 | 2013-09-06 11:21:56 | 2013-09-06 11:21:56 |
| 13 | 2305 | admin ; | 2013-09-06 11:24:22 | 2013-09-06 11:24:09 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 14 | NULL | admin ; | 2013-09-06 11:27:20 | 2013-09-06 11:27:20 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 15 | 2505 | admin ; | 2013-09-06 13:20:03 | 2013-09-06 17:30:00 | leave ; | test Activiti | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 16 | 2512 | admin ; | 2013-09-06 13:59:38 | 2013-09-06 13:59:27 | leave ; | test ; | 0000-0
0-00 00:00:00 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
+ ---- + --------------------- + --------- + -------- ------------- + --------------------- + ------------ + - --------------------------- + -------
-------------- + --------------------- + --------- ------------ + )
Personally, I think the process is this:
dataService.save (entity);
entity is the front passed parameters.
by the Transient ---> Persistent, executed,
1 ° if Sessionn off persistence context lapse. Persistent ---> Detach.
2 ° if the Session is not closed , Hibernate in the set method invocation, should be automatically checked dirty fishes .
transaction as follows:
[...]
[...]
so configured wrong, is not it ?
------ For reference only -------------------------------------- -
After performing dataService.save (entity) after , entity already a Persistent Object it.
just closing the Session , by the Persistent Object ---> Detached Object.
We can use the update (), lock () method to rebind to the persistence context . Changes to the Persistence Object.
Personally, I think , flush () just force the changes propagated to the database. Triggers a transaction commit operation.
desired scene , Hibernate can automatically propagate changes to the database without the need to force manual refresh.
------ For reference only ---------------------------------- -----
Thank you .
Thanks a million and please keep up the
回复删除gratifying work.
Look into my blog..
Manfaat strawberry
Manfaat tomat
Makanan penambah berat badan
Cara menambah berat badan
Manfaat buah semangka
Tanda tanda diabetes
Penyebab kanker
Cara menghilangkan bau badan
Cara mengobati sakit gigi
Cara menurunkan berat badan
Thank you for sharing the info