<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Enable @Transaction on OSGI services</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113642693" />
  <subtitle>Enable @Transaction on OSGI services</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113642693</id>
  <updated>2026-04-04T11:57:52Z</updated>
  <dc:date>2026-04-04T11:57:52Z</dc:date>
  <entry>
    <title>RE: Enable @Transaction on OSGI services</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113649642" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113649642</id>
    <updated>2019-05-16T08:38:04Z</updated>
    <published>2019-05-16T08:38:04Z</published>
    <summary type="html">&lt;blockquote&gt;Eric COQUELIN&lt;br /&gt;&lt;br /&gt;If I correctly understood your answer, I cannot setup transactionnal methods outside of the service builder.&lt;br /&gt;&lt;/blockquote&gt;Well, I &lt;em&gt;guess&lt;/em&gt; you can. but &lt;em&gt;it&amp;#39;s complicated &lt;/em&gt;(TM)&lt;br /&gt;ServiceBuilder has it all implemented already, and it&amp;#39;s &lt;em&gt;by far&lt;/em&gt; easier (and more futureproof / easier to maintain) to just hook into the same mechanism than to come up with your own.</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2019-05-16T08:38:04Z</dc:date>
  </entry>
  <entry>
    <title>RE: Enable @Transaction on OSGI services</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113649208" />
    <author>
      <name>Eric COQUELIN</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113649208</id>
    <updated>2019-05-16T07:57:53Z</updated>
    <published>2019-05-16T07:57:53Z</published>
    <summary type="html">Hi David,&lt;br /&gt;&lt;br /&gt;If I correctly understood your answer, I cannot setup transactionnal methods outside of the service builder.&lt;br /&gt;&lt;br /&gt;Thank you !</summary>
    <dc:creator>Eric COQUELIN</dc:creator>
    <dc:date>2019-05-16T07:57:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: Enable @Transaction on OSGI services</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113645815" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113645815</id>
    <updated>2019-05-15T20:41:16Z</updated>
    <published>2019-05-15T20:41:16Z</published>
    <summary type="html">Well, the difference really is that the SB classes are not OSGi components, they are Spring Beans. As part of the Spring echosystem, the appropriate transaction wrapping occurs.&lt;br /&gt;&lt;br /&gt;We see the SB services as OSGi components because Liferay explicitly exposes the Spring Beans defined in a context as component manually.&lt;br /&gt;&lt;br /&gt;The easiest solution is to build in your own services as ServiceBuilder no-column entities or even as &lt;a href="https://community.liferay.com/blogs/-/blogs/fake-servicebuilder-entities"&gt;Fake Entities&lt;/a&gt;. This way you get all the benefit of SB (including the txn management) without the corresponding database table(s).</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2019-05-15T20:41:16Z</dc:date>
  </entry>
  <entry>
    <title>Enable @Transaction on OSGI services</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113642692" />
    <author>
      <name>Eric COQUELIN</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113642692</id>
    <updated>2019-05-15T17:58:05Z</updated>
    <published>2019-05-15T17:58:05Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Dear community,&lt;br&gt;&lt;br&gt;I have created my own service which is an interface as usual from which my implementation inherits.&lt;br&gt;&lt;br&gt;It gives me the following snippet&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;@Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
        PortalException.class, SystemException.class}, enabled= true)
public interface NotificationService {

  public void mymethod();
  ...

}&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;But when executing any of the methods of the implementation of this interface, there is no transaction.&lt;br&gt;&lt;br&gt;Same annotation is being used by the service builder and it works perfectly.&lt;br&gt;&lt;br&gt;I am afraid it has something to do with the service builder being based on Spring...&lt;br&gt;&lt;br&gt;Can you please help ?&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Eric COQUELIN</dc:creator>
    <dc:date>2019-05-15T17:58:05Z</dc:date>
  </entry>
</feed>
