留言板

RE: Retrieve full user list

thumbnail
Richard Oliver Legendi,修改在14 年前。

Retrieve full user list

Junior Member 帖子: 35 加入日期: 09-11-30 最近的帖子
Hi, just wondering if there's any better solution to access the list of registered users than this:

List<user> users = UserLocalServiceUtil.getUsers(0, Integer.MAX_VALUE);</user>


or is this the standard way?
Andras Robert Imre,修改在14 年前。

RE: Retrieve full user list

New Member 帖子: 4 加入日期: 09-12-1 最近的帖子
Hi,

Looking at the search method of the Directory portlet (com.liferay.portlet.directory.util.DirectoryOpenSearchImpl) which looks for users as well, it seems to me that paged results are preferred for search functions. Which is reasonable, since otherwise these functions could return a quite large number of entities.

If you intend to get all users in one go, you might consider using UserLocalServiceUtil.getUsersCount() instead of Integer.MAX_VALUE.
Vilmos Kozma,修改在14 年前。

RE: Retrieve full user list

Junior Member 帖子: 68 加入日期: 09-11-12 最近的帖子
András Róbert Imre:


If you intend to get all users in one go, you might consider using UserLocalServiceUtil.getUsersCount() instead of Integer.MAX_VALUE.


So what's the point in introducing another persistence call when a simple read operation do?

;)

regards,
Vili