フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) René Jurmann 2011/02/22 5:40
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Ray Augé 2011/03/01 13:45
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) René Jurmann 2011/03/02 2:30
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Vincent Vanghelle 2011/03/07 9:18
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Vincent Vanghelle 2011/03/08 2:13
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Aritz Galdos 2011/03/10 6:49
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Vincent Vanghelle 2011/03/10 6:52
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) René Jurmann 2011/03/10 6:53
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Aritz Galdos 2011/03/10 7:54
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Ray Augé 2011/03/21 6:36
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Aritz Galdos 2011/03/21 6:51
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Jack Daniels 2011/03/23 9:36
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Aritz Galdos 2011/03/23 9:45
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Jack Daniels 2011/03/23 10:48
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Igor Spasić 2011/03/25 8:27
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) parth barot 2011/04/11 22:22
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) parth barot 2011/04/11 22:38
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Aritz Galdos 2011/04/12 0:13
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search) Jack Daniels 2011/04/12 5:40
René Jurmann
Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/02/22 5:40
答え

René Jurmann

ランク: Junior Member

投稿: 27

参加年月日: 2010/11/15

最近の投稿

Hi all,

I experienced a bug within the Enterprise Edition 6 SP1.
We have following scenario:

We search for users according their attributes within the custom fields. Therefore we have added one custom field "AccountID" to the user object (using Control Panel).
In order to search for users that match a range of account IDs we use following code:

 1
 2String[] accountIds = ...;
 3ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
 4long companyId = themeDisplay.getCompanyId();
 5ExpandoColumn expColumn = ExpandoColumnLocalServiceUtil.getDefaultTableColumn(companyId, User.class.getName(), "AccountID");
 6Set<Long> expValueUserIds = new HashSet<Long>();
 7ClassLoader cl = PortalClassLoaderUtil.getClassLoader();
 8dynamicQuery = DynamicQueryFactoryUtil.forClass(ExpandoValue.class, cl);
 9dynamicQuery.add(RestrictionsFactoryUtil.eq("tableId", expColumn.getTableId()));
10dynamicQuery.add(RestrictionsFactoryUtil.eq("columnId", expColumn.getColumnId()));
11dynamicQuery.add(RestrictionsFactoryUtil.in("data", accountIds));
12List<ExpandoValue> expValues = ExpandoValueLocalServiceUtil.getService().dynamicQuery(dynamicQuery);
13if(expValues != null && expValues.size() > 0){
14    for(ExpandoValue expValue : expValues){
15        expValueUserIds.add(new Long(expValue.getClassPK()));
16    }
17}


This works for the CE portal version 6.0.5 (some of our development environments are running on this version).
But when we execute this code on EE portal version 6 SP1 no result is found although some should be found.
In order to get this search to work with EE version I need to rewrite the whole coding to:

 1
 2String[] accountIds = ...;
 3ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
 4long companyId = themeDisplay.getCompanyId();
 5ExpandoColumn expColumn = ExpandoColumnLocalServiceUtil.getDefaultTableColumn(companyId, User.class.getName(), "AccountID");
 6Set<Long> expValueUserIds = new HashSet<Long>();
 7for(int count = 0; count < accountIds.length; count++){
 8    ClassLoader cl = PortalClassLoaderUtil.getClassLoader();
 9    dynamicQuery = DynamicQueryFactoryUtil.forClass(ExpandoValue.class, cl);
10    dynamicQuery.add(RestrictionsFactoryUtil.eq("tableId", expColumn.getTableId()));
11    dynamicQuery.add(RestrictionsFactoryUtil.eq("columnId", expColumn.getColumnId()));
12    dynamicQuery.add(RestrictionsFactoryUtil.like("data", accountIds[count]));
13    List<ExpandoValue> expValues = ExpandoValueLocalServiceUtil.getService().dynamicQuery(dynamicQuery);
14    if(expValues != null && expValues.size() > 0){
15        for(ExpandoValue expValue : expValues){
16            expValueUserIds.add(new Long(expValue.getClassPK()));
17        }
18    }
19}


Can anyone tell me if searching for a range:
1dynamicQuery.add(RestrictionsFactoryUtil.in("data", accountIds));

works in EE version 6 SP1 and how I should configure it?

regards
René Jurmann
Ray Augé
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/01 13:45
答え

Ray Augé

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1238

参加年月日: 2005/02/07

最近の投稿

Can you try:
1PropertyFactoryUtil.forName("data").in(accountIds)
2
3//in placed of
4
5RestrictionsFactoryUtil.in("data", accountIds)
René Jurmann
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/02 2:30
答え

René Jurmann

ランク: Junior Member

投稿: 27

参加年月日: 2010/11/15

最近の投稿

Hi Ray,

that still does not work.
Here as well - when I execute
1PropertyFactoryUtil.forName("data").like(accountId)

in a loop all corresponding users are found. But as soon as I want to use the range search
1PropertyFactoryUtil.forName("data").in(accountIds)

no result is returned
Vincent Vanghelle
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/07 9:18
答え

Vincent Vanghelle

ランク: New Member

投稿: 3

参加年月日: 2011/03/03

最近の投稿

Hi.

It looks like i have the same problem..

On 6.0.5 it was OK, then I switched to a Liferay EE SP1 version..Here is the code sample :

1DynamicQuery queryRegion = DynamicQueryFactoryUtil.forClass(ExpandoValue.class, cl);
2queryRegion.setProjection(ProjectionFactoryUtil.property("classPK"));
3queryRegion.add(RestrictionsFactoryUtil.eq("tableId",columnRegions.getTableId()));
4queryRegion.add(RestrictionsFactoryUtil.eq("columnId",columnRegions.getColumnId()));
5queryRegion.add(RestrictionsFactoryUtil.in("data", codesRegion));
6/*codesRegion = array of string, also tried with the propertyFactoryUtil.forname("data").in() method */


Doesn't work, but this one works :
1
2DynamicQuery queryRegion = DynamicQueryFactoryUtil.forClass(ExpandoValue.class, cl);
3queryRegion.setProjection(ProjectionFactoryUtil.property("classPK"));
4queryRegion.add(RestrictionsFactoryUtil.eq("tableId",columnRegions.getTableId()));
5queryRegion.add(RestrictionsFactoryUtil.eq("columnId",columnRegions.getColumnId()));
6queryRegion.add(RestrictionsFactoryUtil.eq("data",codesRegion[0]));
Vincent Vanghelle
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/08 2:13
答え

Vincent Vanghelle

ランク: New Member

投稿: 3

参加年月日: 2011/03/03

最近の投稿

Okey, I found this while debugging :


In class com.liferay.portal.dao.orm.hibernate.StringType :
1
2public Object getPropertyValue(Object component, int property) {
3    return null;
4}


With this method, a "in" restrictions construct a prepared statement with null values...
Aritz Galdos
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/10 6:49
答え

Aritz Galdos

ランク: Expert

投稿: 396

参加年月日: 2007/05/15

最近の投稿

Hi,

Has it been reported as a bug?

regards!
Vincent Vanghelle
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/10 6:52
答え

Vincent Vanghelle

ランク: New Member

投稿: 3

参加年月日: 2011/03/03

最近の投稿

Hi Aritz,

I haven't done anything yet, no much time (and never reported a bug on Liferay)

Where can we report this bug?
René Jurmann
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/10 6:53
答え

René Jurmann

ランク: Junior Member

投稿: 27

参加年月日: 2010/11/15

最近の投稿

Hi Aritz,

no, I haven't done anything like this up to now.
(Would need second logon to issues.liferay.com, correct?)

regards
René
Aritz Galdos
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/10 7:54
答え

Aritz Galdos

ランク: Expert

投稿: 396

参加年月日: 2007/05/15

最近の投稿

HI,

I can not report for Sp1 with my user.

I contacted Juan (Liferay Staff) and alerted him about the possible bug.

Hopefully (if it is a bug) will be solved soon.

Regards!!
Ray Augé
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/21 6:36
答え

Ray Augé

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1238

参加年月日: 2005/02/07

最近の投稿

I just tested again with 6.0.6 CE and a simple hook, and it worked exactly as expected.

The hook is attached.
添付ファイル: test-dynamic-query-hook-6.0.6.1.war (5.1k)
Aritz Galdos
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/21 6:51
答え

Aritz Galdos

ランク: Expert

投稿: 396

参加年月日: 2007/05/15

最近の投稿

Hi Ray:

I think it affects 6.0.11 (SP1) and trunk.

AS vincent says here, there is a suspicious "return null"
Jack Daniels
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/23 9:36
答え

Jack Daniels

ランク: New Member

投稿: 19

参加年月日: 2010/05/17

最近の投稿

Has this been verified yet by any Liferay staff member in EE 6.0 SP1 as originally reported?

Thanks.
Aritz Galdos
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/23 9:45
答え

Aritz Galdos

ランク: Expert

投稿: 396

参加年月日: 2007/05/15

最近の投稿

Hi,

Seems to be a bug and I´ve been told Liferay guys are workin' on it. Surely will be solved in short.
Jack Daniels
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/23 10:48
答え

Jack Daniels

ランク: New Member

投稿: 19

参加年月日: 2010/05/17

最近の投稿

Thanks for the quick response Aritz, I appreciate it.

Cheers.
Igor Spasić
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/03/25 8:27
答え

Igor Spasić

LIFERAY STAFF

ランク: New Member

投稿: 10

参加年月日: 2010/04/26

最近の投稿

We filed the issue: http://issues.liferay.com/browse/LPS-16064

The core problem is in the StringType:

1public Object getPropertyValue(Object component, int property) {
2    return null;
3}


Hibernate v3.6.x uses this method when populating IN section while generating SQL. This issue was introduced when we migrated to Hibernate 3.6.0. Fix is committed to svn. For more details, please check the LPS.
parth barot
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/04/11 22:22
答え

parth barot

ランク: Junior Member

投稿: 42

参加年月日: 2010/04/30

最近の投稿

Then what is the solution for this? Do we have any patch for this? Please reply, i need this urgently..stuck at IN operator.

Thanks
parth barot
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/04/11 22:38
答え

parth barot

ランク: Junior Member

投稿: 42

参加年月日: 2010/04/30

最近の投稿

I am trying using the latest StringType in ext plugin...

http://svn.liferay.com/browse/portal/trunk/portal-impl/src/com/liferay/portal/dao/orm/hibernate/StringType.java?r1=69338&r2=76173&u=3

Thanks
Aritz Galdos
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/04/12 0:13
答え

Aritz Galdos

ランク: Expert

投稿: 396

参加年月日: 2007/05/15

最近の投稿

Hi

If you are enterprise user, you should report the incident in the tool Liferay offers to its clients.

Our client, which is enterprise client of Liferay, already got the patch for this issue from liferay.
Jack Daniels
RE: Bug in Dynamic Query for Enterprise Edition 6 SP1 (range search)
2011/04/12 5:40
答え

Jack Daniels

ランク: New Member

投稿: 19

参加年月日: 2010/05/17

最近の投稿

Too bad they only send the patch to customers that ask for it as opposed to publishing it through the customer or partner portal.

I'll have to ask for it for our EE customer as well. Thanks for mentioning this.