[deepamehta-devel] Transactions

Jörg Richter jri at deepamehta.de
Fri Sep 16 18:10:32 CEST 2016


Hi Robert,

in your updateEditablePerson() resource method you create a transaction:

	@PUT
	@Path("...")
	public void updateEditablePerson(...) {
		DeepaMehtaTransaction tx = dm4.beginTx();
		try {
			...
			tx.success();
		} finally {
			tx.finish();
		}
	}

In a JAX-RS resource method you're not required to create a transaction manually.
Instead you can rely on DM's @Transactional annotation:

	import de.deepamehta.core.service.Transactional;

	@PUT
	@Path("...")
	@Transactional
	public void updateEditablePerson(...) {
		...
	}

This wraps the entire request processing in a transaction.

There are rare cases in DM when you're required to create a transaction manually.

Cheers,
Jörg

-------------- n�chster Teil --------------
Ein Dateianhang mit Bin�rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr��e  : 496 bytes
Beschreibung: Message signed with OpenPGP using GPGMail
URL         : <http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/attachments/20160916/34edf3d9/attachment.sig>


More information about the devel mailing list