Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 915766

Summary: OrganizationService.getUserHandler().findUsersByGroupId(groupid) not working with H2 database
Product: [JBoss] JBoss Enterprise Portal Platform 6 Reporter: Martin Weiler <mweiler>
Component: PicketLinkAssignee: Boleslaw Dawidowicz <bdawidow>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0CC: bdawidow, dpospisi, mposolda, mvecera, trangvh
Target Milestone: ER01   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Release Note
Doc Text:
CAUSE: The OrganizationService.getUserHandler().findUsersByGroupId(groupid) call does not work with some databases (like default Hypersonic 2 database and PostgreSQL9). Some other certified databases like MySQL worked. CONSEQUENCE: Consequence to JPP is not so big because this operation is not called from any place in JPP UI. However people may need to create portlets and call this operation from their portlets, which didn't work. FIX: The error was fixed in Picketlink IDM library. It was caused by the fact that Hibernate HQL query generated SQL query to database, which wasn't compatible with some databases and so SQL call failed for some databases. The fix changed HQL query to the form, that generated SQL query is compatible with all databases RESULT: Fix was added to Picketlink IDM library into version 1.4.2.CR01. So once JPP is changed to use this (or newer) version, the bug can't be reproduced anymore and it's possible to correctly invoke operation OrganizationService.getUserHandler().findUsersByGroupId(groupid)
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-07 14:24:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Weiler 2013-02-26 13:15:21 UTC
Description of problem:
Using default setup with H2 database, calling  OrganizationService.getUserHandler().findUsersByGroupId(groupid) raises an exception.

Executing the following code:
30    users = organizationService.getUserHandler().findUsersByGroupId("/platform/users");
31
32    if (users.getSize() > 0)
33    {

results in the following exception:
11:01:30,352 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-2) SQL Error: 90068, SQLState: 90068
11:01:30,352 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-2) Order by expression "HIBERNATEI2_.NAME" must be in the result list in this case; SQL statement:
select distinct hibernatei1_.ID as ID4_, hibernatei1_.IDENTITY_TYPE as IDENTITY2_4_, hibernatei1_.NAME as NAME4_, hibernatei1_.REALM as REALM4_ from jbid_io_rel hibernatei0_ inner join jbid_io hibernatei1_ on hibernatei0_.TO_IDENTITY=hibernatei1_.ID cross join jbid_io hibernatei2_ cross join jbid_io hibernatei3_ where hibernatei0_.TO_IDENTITY=hibernatei2_.ID and hibernatei0_.FROM_IDENTITY=hibernatei3_.ID and hibernatei2_.REALM=? and hibernatei3_.REALM=? and (hibernatei2_.NAME like ?) and hibernatei0_.FROM_IDENTITY=? order by hibernatei2_.NAME asc [90068-168]
11:01:30,355 ERROR [stderr] (http-/127.0.0.1:8080-2) org.picketlink.idm.api.query.QueryException: Failed to execute query
11:01:30,356 ERROR [stderr] (http-/127.0.0.1:8080-2)         at org.picketlink.idm.impl.api.query.UserQueryExecutorImpl.execute(UserQueryExecutorImpl.java:220)
11:01:30,356 ERROR [stderr] (http-/127.0.0.1:8080-2)         at org.picketlink.idm.impl.api.query.UserQueryExecutorImpl.list(UserQueryExecutorImpl.java:245)
11:01:30,356 ERROR [stderr] (http-/127.0.0.1:8080-2)         at org.picketlink.idm.impl.api.session.IdentitySessionImpl.list(IdentitySessionImpl.java:364)
11:01:30,356 ERROR [stderr] (http-/127.0.0.1:8080-2)         at org.exoplatform.services.organization.idm.IDMUserListAccess.getSize(IDMUserListAccess.java:123)
11:01:30,356 ERROR [stderr] (http-/127.0.0.1:8080-2)         at org.exoplatform.demo.portlet.portletOrganization.doView(portletOrganization.java:32)

The same issue does not show up with other databases, such as MySQL.

Comment 3 Dominik Pospisil 2013-08-26 14:01:06 UTC
Just wondering, the customer is using H2 in production?

Comment 4 Martin Weiler 2013-08-26 14:11:55 UTC
No, the customer is not using H2 in production. The issue was discovered during testing.

Comment 5 Dominik Pospisil 2013-08-27 09:15:23 UTC
Thanks Martin!

Comment 6 Dominik Pospisil 2013-08-27 09:16:00 UTC
Verified (ER4).