<?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>What is the right way of implementing simple User-entity link in CE 7.x?</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113431983" />
  <subtitle>What is the right way of implementing simple User-entity link in CE 7.x?</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113431983</id>
  <updated>2026-04-06T09:00:28Z</updated>
  <dc:date>2026-04-06T09:00:28Z</dc:date>
  <entry>
    <title>RE: What is the right way of implementing simple User-entity link in CE 7.x</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113480457" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113480457</id>
    <updated>2019-05-01T03:48:18Z</updated>
    <published>2019-05-01T03:48:18Z</published>
    <summary type="html">Hi Dimitriy,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m not entirely sure I am following but let&amp;#39;s see. From what I understand you (of course) have a User table (Liferay provided as we all know) and then you have a WishList table which you have defined in service builder. And now you want to link the two -- and if I am understanding you correctly, I think the simplest answer is to have a &lt;br /&gt;&lt;br /&gt;User_WishList&lt;br /&gt;&lt;br /&gt;mapping table (service builder entity). You can include just the userId and the wishListId to limit the number of columns, but I would only do that if I knew my Liferay install would only ever have one portal instance and one site. I understand that you wuld rather have 1000 users all wishing for the same item to be stored in a single row, but a you can see that&amp;#39;s not as easy. The userId/wishListId would be unique though so you could define a finder in which case the looks ups would be super fast. &lt;br /&gt;&lt;br /&gt;You seem to be concerned about the potential size of the data (number of records) -- are you expecting a huge volume?</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2019-05-01T03:48:18Z</dc:date>
  </entry>
  <entry>
    <title>What is the right way of implementing simple User-entity link in CE 7.x?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113431982" />
    <author>
      <name>Dmitriy Kuznetsov</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113431982</id>
    <updated>2019-04-27T23:45:50Z</updated>
    <published>2019-04-27T23:45:50Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi!&lt;br&gt;&lt;br&gt;There is a simple &lt;strong&gt;CustomEntity &lt;/strong&gt;in project. The entity is Asset-enabled. It's necessary to link the &lt;strong&gt;CustomEntity &lt;/strong&gt;with Liferay &lt;strong&gt;User &lt;/strong&gt;entity to create a User's wishlist. &lt;br&gt;&lt;br&gt;Technically, it's a many-to-many relationship table between &lt;strong&gt;CustomEntity &lt;/strong&gt;and &lt;strong&gt;User&lt;/strong&gt;. Would be great if i can describe the relationship in &lt;strong&gt;services.xm&lt;/strong&gt;l like following:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;entity name="CustomEntity" local-service="true" remote-service="false" cache-enabled="false"&amp;gt;

    &amp;lt;column name="id" type="long" primary="true" /&amp;gt;

    &amp;lt;column name="wishedBy" type="Collection" entity="com.liferay.portal.kernel.model.User" mapping-table="User2CustomEntityWishList" /&amp;gt;

&amp;lt;/entity&amp;gt;&lt;/code&gt;&lt;/pre&gt;... but Service builder generates CustomEntityLocalServiceBaseImpl code expecting related methods(addCustomEntity(), removeCustomEntity(), etc.) in&amp;nbsp;&lt;strong&gt;&lt;a href="eclipse-javadoc:%E2%98%82=InfoPack-service/D:%5C/Infrastructure%5C/Java%5C/%5C!gradle-repo%5C/caches%5C/modules-2%5C/files-2.1%5C/com.liferay.portal%5C/com.liferay.portal.kernel%5C/3.46.2%5C/2c3aeef46b9562a8227b361e64410d1784ec9a66%5C/com.liferay.portal.kernel-3.46.2.jar%3Ccom"&gt;&lt;/a&gt;com.liferay.portal.kernel.service.persistence.UserPersistence&lt;/strong&gt; class.&amp;nbsp; The code, of cource, is not compilable.&lt;br&gt;&lt;br&gt;The idea of adding as little as a many-to-many table and couple of methods to &lt;strong&gt;CustomEntityService&lt;/strong&gt; to lookup &lt;strong&gt;CustomEntities &lt;/strong&gt;by &lt;strong&gt;User &lt;/strong&gt;/ &lt;strong&gt;User.id&lt;/strong&gt; looks attractive. Would be great to utilize the system as much as possible. Is there a way to do this?&lt;br&gt;&lt;br&gt;Alternatively, if none, can i avoid creating service(s) for wishlist and overbloating the many-to-many table with Status / Audit fields, finders, references, etc? How to implement it in the most simple and lighweight way?&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Dmitriy&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Dmitriy Kuznetsov</dc:creator>
    <dc:date>2019-04-27T23:45:50Z</dc:date>
  </entry>
</feed>
