Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
AssetEntry for a Service Builder entity with two primary keys
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
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
Mirko Romstadt:
AFAIK that's it. AssetEntry PKs (or was it FKs in this case?) need to match your Entity's PK
Is there any method I missed or do I have to convert my entity to have a single primary key of type long?
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
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™