Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jay Sellers
What is classPK?
April 12, 2008 4:00 PM
Answer

Jay Sellers

Rank: New Member

Posts: 21

Join Date: April 12, 2008

Recent Posts

I can't seem to find a solid definition of what "classPK" is, can someone answer this for me? I've searched the LifeRay forums and have found many references to it, but no definitions.

If it helps, I'm analyzing the relationships between the tables used by the Message Board portlet.
claudia wagner
RE: What is classPK?
April 13, 2008 1:07 AM
Answer

claudia wagner

Rank: New Member

Posts: 6

Join Date: April 13, 2008

Recent Posts

I also need a explanation of classPK, because I want to extend the page-rating and the page-commenting functionality.
Anyone here how knows about classPK?
Bruno Farache
RE: What is classPK?
April 13, 2008 9:21 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 505

Join Date: May 14, 2007

Recent Posts

You can comment about some certain types of entities, say for example, a blog entry with pk 23, then classNameId will refer to a classname_ table row that holds value "com.liferay...BlogsEntry" and classPK will be 23.

Claudia, I guess the class name you will use is "com.liferay.portal.model.Layout".
Jay Sellers
RE: What is classPK?
April 13, 2008 12:35 PM
Answer

Jay Sellers

Rank: New Member

Posts: 21

Join Date: April 12, 2008

Recent Posts

Thanks Bruno! So the className is essentially a reference to a database table and the classPK is the primary key reference in that table.

So, for example, when looking at the Subscription table, if I see a record with a classNameId of 10063 and a classPK of 11010 then:
1. I go to the className table and look for the value related to classNameId of 10063.
2. Seeing that the value for 10063 is "com.liferay.portlet.messageboards.model.MBCategory", I know to next look at the MBCATEGORY liferay database table.
3. I now look for a record in here with a categoryId equal to my initial classPK in the subscription table (11010).

I understand whats going on here, thanks much for the clarification.

-Jay
claudia wagner
RE: What is classPK?
April 14, 2008 12:58 AM
Answer

claudia wagner

Rank: New Member

Posts: 6

Join Date: April 13, 2008

Recent Posts

Thanks Bruno! I also understand whats classPK.
classPK corresponds to the plid of each page in the layout table.
ok, so I will have to change the Page Comment Portlet so, that it will be possible to show more comment therads on one page...
Marquita Priester
RE: What is classPK?
December 17, 2014 8:58 AM
Answer

Marquita Priester

Rank: New Member

Posts: 3

Join Date: September 5, 2014

Recent Posts

I know this question is old, but what is class name and classPk as relates to the sanitize function? I'm implementing the sanitize function.
David H Nebinger
RE: What is classPK?
December 17, 2014 12:20 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7250

Join Date: September 1, 2006

Recent Posts

It is still the same answer.

Class name is the name of an entity and class PK is the primary key value which represents a unique entity.

Conceptually it allows a Liferay table to refer to any entity using a loosely defined/weak reference. For example, the AssentEntry table/entity is for a Liferay asset (a unique value), but the asset refers to some other entity such as a blog entry, a message board post, a web content article, ... The class name defines the type of entity and the class PK is the primary key (so you can identify a unique blog entry, message board post, web content article), ...

For whatever sanitize function you're talking about, the concept of the class name and pk is still the same.