Message Boards

AssetEntry for a Service Builder entity with two primary keys

Mirko Romstadt, modified 4 Years ago.

AssetEntry for a Service Builder entity with two primary keys

New Member Posts: 17 Join Date: 7/23/14 Recent Posts
Hi,
Is it possible to create an AssetEntry for a Service Builder entity that has two primary keys? The Liferay tutorial (https://help.liferay.com/hc/en-us/articles/360034857611-Handling-Assets-for-the-GuestbookEntry-Service) gives an example for the GuestbookEntry entity that has the entryId of type long as a primary key. I would like to do this with a Service Builder entity that has two fields as primary key and thus has a nameOfTheEntityPK of type NameOfTheEntityPK. This does not work with the AssetEntry methods as it expects long.
Is there any method I missed or do I have to convert my entity to have a single primary key of type long?
Thanks,
​​​​​​​Mirko
thumbnail
Olaf Kock, modified 4 Years ago.

RE: AssetEntry for a Service Builder entity with two primary keys (Answer)

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Mirko Romstadt:

Is there any method I missed or do I have to convert my entity to have a single primary key of type long?
AFAIK that's it. AssetEntry PKs (or was it FKs in this case?) need to match your Entity's PK
Mirko Romstadt, modified 4 Years ago.

RE: AssetEntry for a Service Builder entity with two primary keys

New Member Posts: 17 Join Date: 7/23/14 Recent Posts
AssetEntry PKs (or was it FKs in this case?) need to match your Entity's PK

I had a look at the AssetEntry table, the AssetEntry PK is the entryId which never matches the entity's PK (which is stored in the classPK column). But anyway, if I got you right, I need to add a (long) primary key to my entity to make it work with AssetEntries.
Thanks!
​​​​​​​Mirko