[deepamehta-devel] Transactions

Robert Schuster robert.schuster.rs01 at gmail.com
Mon Sep 19 21:10:21 CEST 2016


Hi Joerg,
ok, I have to confess I am not allto versed with all the JAX RS
annotations. After I wrote this code I saw a JAX RS example that had
"Transactional" in it and I was thinking "Hm, I probably should use that
instead of creating that Transaction object manually". :-)

Best regards
Robert

Am 16.09.2016 um 18:10 schrieb Jörg Richter:
> 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
>
>
>

-- 
Robert Schuster
freiberuflicher Softwareingenieur

RS01 - IT-Systemanalyse und -entwicklung Robert Schuster
Brückenstraße 4 • 12439 Berlin
+49 157 798 00 310
robert.schuster.rs01 at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/attachments/20160919/3035bd1d/attachment.html>


More information about the devel mailing list