Cannot re-save a new IMObject after transaction rollback
OBF-186
Getting hibernate LazyInitializationException when acccessing targetLookupRelationships
OBF-105
ArchetypeService.validateObject() ignores filter criteria
OBF-49
Lost update problem if relationships are created and saved independently of their parent objects
OBF-252
Add group-by clause support to ArchetypeQuery
OBF-241
Update spring, hibernate dependencies
OBF-237
Extend ArchetypeQuery to support details nodes in eq, ne constraints
OBF-236
Replace bidirectional many-to-many relationship between users and roles with unidirectional one to improve performance
OBF-233
Add support for uni-directional entity relationships
OBF-228
Improve Entity classification retrieval performance
OBF-222
NullPointerException during validation
OBF-220
java.lang.IllegalArgumentException: Invalid argument 'archetypeId'
OBF-219
dataload not loading relationships
OBF-216
IMObjectDAOHibernate doesn't use archetype id when querying by IMObjectReference
OBF-215
Add support to UserDAOHibermate to filter users by archetype
OBF-214
Lookup replacement should increment affected object's version no.s
OBF-207
ArchetypeAwareVoter triggers ClassCastException
OBF-206
Improve performance of IMObject <-> IMObjectDO assembly by lazy loading relationships
OBF-203
Add support to revert rule changes on transaction rollback
OBF-202
Maven 2 pom.xml
OBF-201
Extend openvpms:get() xpath function to support PropertySets
OBF-198
Enable uncommitted objects to be retrieved by reference in a transaction
OBF-197
Add uid node support to NodeResolver
OBF-195
Add fixedCost and unitCost attributes to FinancialAct
OBF-194
Add support for lookup caching
OBF-193
Remove linkIds to improve query performance
OBF-192
NonUniqueObjectException thrown when child act reloaded in transaction prior to parent save
OBF-190
Entity on-delete="cascade" for EntityRelationships not working
OBF-189
Remove check for duplicate relationship from Entity.addEntityRelationship()
OBF-184
Remove active flag from EntityRelationship and ActRelationship
OBF-182
Child tables missing cascade delete constraints
OBF-181
Automatically add IS NULL clauses for archetype constraints in left joins
OBF-180
Create new archetype query language (AQL)
OBF-179
Cannot perform queries on an Entity's relationships
OBF-178
Add transaction support to archetype service
OBF-177
Add support to trigger rules for IArchetypeService.save(Collection<IMObject>) method
OBF-176
Editing archetypes gets failure to initialise lazy collection error
OBF-174
Hibernate error saving EntityIdentity instances
OBF-173
Increase column size of assertion_descriptors.property_map
OBF-172
StaleObjectStateException generated when performing OTC workflow
OBF-170
Modify IMObjectCopier to return copied objects rather than save
OBF-169
Add support for IN constraints to ArchetypeQuery
OBF-168
ArchetypeServiceDescriptorTestCase failing with StaleObjectStateException
OBF-167
ArchetypeQuery doesn't support RelationalOp.IsNull comparisons for IMObjectReference nodes
OBF-166
IArchetypeService.save(Collection<IMObject>) fails for Acts referencing the same ActRelationship
OBF-163
Remove archetype and participation redundancy from database schema
OBF-162
Null value for details node produces "Duplicate entry" SQL error on update
OBF-161
Add support for HQL 'with' in join conditions
OBF-159
Replace XML serialized details columns with separate tables
OBF-157
Add on-delete="cascade" to parent-child key definitions to simplify deletion via SQL
OBF-156
issue 1 of 249

Cannot re-save a new IMObject after transaction rollback

Description

If a new IMObject is saved in a transaction, and the transaction rolls back, it keeps the id generated by hibernate,
This prevents the object being saved subsequently, when the problem is corrected.
To reproduce (in the context of ArchetypeServiceActTestCase):

// Create 2 acts with the following relationships:
// act1 – (parent/child) --> act2
final Act act1 = createSimpleAct("act1", "IN_POGRESS");
final Act act2 = createSimpleAct("act2", "IN_PROGRESS");

ActRelationship rel = addRelationship(act1, act2, "act1->act2", true);

try {
template.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
service.save(act1);
service.save(act2);
throw new RuntimeException("Trigger rollback");
}
});
fail("Expected transaction to fail");
} catch (Exception expected) {
try {
template.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
service.save(act1);
service.save(act2);
return null;
}
});
} catch (Exception error) {
fail("Expected transaction to succeed");
}
}

The above will work if the ids are reset after the initial rollback.

Environment

None

Status

Assignee

TonyT

Reporter

Tim Anderson

Labels

None

Fix versions

Affects versions

Priority

Critical
Configure