<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>JBoss Weld on Laliluna.de - Sebastian Hennebrüder</title><link>https://www.laliluna.de/tags/jboss-weld/</link><description>Recent content in JBoss Weld on Laliluna.de - Sebastian Hennebrüder</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 12 Jan 2011 00:00:00 +0000</lastBuildDate><atom:link href="https://www.laliluna.de/tags/jboss-weld/index.xml" rel="self" type="application/rss+xml"/><item><title>JBoss Weld transactions with JPA and Hibernate in Java SE</title><link>https://www.laliluna.de/articles/2011/01/12/jboss-weld-jpa-hibernate.html</link><pubDate>Wed, 12 Jan 2011 00:00:00 +0000</pubDate><guid>https://www.laliluna.de/articles/2011/01/12/jboss-weld-jpa-hibernate.html</guid><description>&lt;p&gt;I am using Weld in a plain Java application (alias Java SE). I would like to inject an entity manager and use a &lt;em&gt;@Transactional&lt;/em&gt; annotation to mark a method as transactional. A transaction should be&#10;started before the method is executed and commited after the method was called. In addition exceptions should cause a rollback of the transaction.&lt;/p&gt;&#10;&lt;pre class="lang-java"&gt;&#10;@ApplicationScoped &#10;public class PlayerServiceBean {&#10;&#10;&#9;@Inject&#10;&#9;private EntityManager em;&#10;&#10;&#9;@Transactional&#10;&#9;public void createPlayer(Player player) {&#10;&#9;&#9;em.persist(player);&#10;&#9;}&#10;}&#10;&lt;/pre&gt;&#10;&lt;h2&gt;The wrong way&lt;/h2&gt;&#10;&lt;p&gt;I found various discussions but as at the time of writing JBoss Weld is still young, there seems to be no various ideas floating around but no best way.&lt;/p&gt;</description></item></channel></rss>