Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/util/data/DataTransaction.java @ 1290:14876c62f692
Push down refreshing of persisted objects deeper into the stack.
There are more places besides creation of Probe objects where it is
useful to return within the response what has been really written to
the database (including modifications by the database itself) instead
of merely the request data, e.g. creation of Ort objects, which
includes database generated ort_ids.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 08 Feb 2017 18:02:05 +0100 |
parents | 7683c4162746 |
children |
comparison
equal
deleted
inserted
replaced
1289:788311087838 | 1290:14876c62f692 |
---|---|
46 throws EntityExistsException, | 46 throws EntityExistsException, |
47 IllegalArgumentException, | 47 IllegalArgumentException, |
48 EJBTransactionRolledbackException, | 48 EJBTransactionRolledbackException, |
49 TransactionRequiredException | 49 TransactionRequiredException |
50 { | 50 { |
51 emp.entityManager(dataSource).persist(object); | 51 EntityManager manager = emp.entityManager(dataSource); |
52 manager.persist(object); | |
53 | |
54 /* Refreshing the object is necessary because some objects use | |
55 dynamic-insert, meaning null-valued columns are not INSERTed | |
56 to the DB to take advantage of DB DEFAULT values, or triggers | |
57 modify the object during INSERT. */ | |
58 manager.refresh(object); | |
52 } | 59 } |
53 | 60 |
54 /** | 61 /** |
55 * Create object in the database. | 62 * Create object in the database. |
56 * This operation can not be undone. | 63 * This operation can not be undone. |