Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] Help With Error org.hibernate.NonUniqueResultException:,// query did not return a unique result

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] Help With Error org.hibernate.NonUniqueResultException:,// query did not return a unique result


Chronological Thread 
  • From: Shilen Patel <>
  • To: Chris Hyzer <>
  • Cc: Colin Hudler <>, Grouper Users Mailing List <>
  • Subject: Re: [grouper-users] Help With Error org.hibernate.NonUniqueResultException:,// query did not return a unique result
  • Date: Tue, 10 Feb 2009 12:58:08 -0500

Hi Colin,

Could it be the cause of my problem that this group is twice an
immediate member?

If both rows in grouper_memberships also have the same field_id (in addition to having the same owner_id, member_id and mship_type of immediate), then you are right. If you can delete one of those two rows, that should take care of your problem.


Shilen, can you respond about "bad memberships"?
Also, Im curious if that method FindByOwnerAndMemberAndFieldAndType should not throw an error if there are dupes... if could just return one of them and delete the other? Something like that to make things more graceful? With the membership table changes in 1.5 can we add another unique index so this cant happen?

Bad membership finder won't actually address this issue since that utility focuses more on finding composite and effective memberships that were calculated incorrectly. It assumes that immediate memberships must be right... Bad assumption apparently. :)

But regardless, I think your suggestion is probably the better fix for this. I created a Jira issue and assigned it to myself.

Last I checked, the unique constraint would not work on all databases, but I'll see what changes you've made to that table and see what options we have now.

Thanks!

-- Shilen



On Feb 10, 2009, at 11:14 AM, Chris Hyzer wrote:

Shilen, can you respond about "bad memberships"?
Also, Im curious if that method FindByOwnerAndMemberAndFieldAndType should not throw an error if there are dupes... if could just return one of them and delete the other? Something like that to make things more graceful? With the membership table changes in 1.5 can we add another unique index so this cant happen?

Thanks,
Chris

-----Original Message-----
From: Colin Hudler
[mailto:]
Sent: Tuesday, February 10, 2009 10:54 AM
To: Grouper Users Mailing List
Subject: [grouper-users] Help With Error
org.hibernate.NonUniqueResultException:,// query did not return a
unique result

I just created a group, which has other groups as members. Everything
seemed fine, but when looking at one of the members with the UI, it
would say "There was a serious error connecting to the database". In
the logs it produced an identical error to gsh, which is below.

gsh 3% g.delete()
// Error: unable to evaluate command: Sourced file: inline evaluation
of: `` g.delete();'' : Method Invocation g.delete
// See error log for full stacktrace
// caused by:
edu.internet2.middleware.grouper.exception.GroupDeleteException:
// Problem in HibernateSession: HibernateSession: isNew: true,
isReadonly: true, grouperTransactionType: READONLY_NEW,
Exception in uniqueResult: (class [Ljava.lang.Object;), ByHqlStatic,
query: 'select ms, m from Membership as ms, Member as m, Field as field
where ms.ownerUuid = :owner and ms.memberUuid =
:member and ms.fieldId = field.uuid and field.name =
:fname and field.typeString = :ftype and
ms.type = :type and ms.memberUuid = m.uuid',
cacheable: false, cacheRegion:
edu .internet2.middleware.grouper.internal.dao.hib3.Hib3MembershipDAO.Fi
ndByOwnerAndMemberAndFieldAndType,
tx type: nullBind var[0]: 'Param (class java.lang.String):
'owner'->'41f8d440-e715-4f9f-809f-2c491165ea62', Bind var[1]: 'Param
(class java.lang.String):
'member'->'4208396d-9b34-4e51-92c2-759b9fa9bb60', Bind var[2]: 'Param
(class java.lang.String): 'fname'->'members', Bind var[3]: 'Param
(class
java.lang.String): 'ftype'->'list'Bind var[4]: 'Param (class
java.lang.String): 'type'->'immediate',
// caused by:
edu.internet2.middleware.grouper.internal.dao.GrouperDAOException:
// Problem in HibernateSession: HibernateSession: isNew: true,
isReadonly: true, grouperTransactionType: READONLY_NEW,
Exception in uniqueResult: (class [Ljava.lang.Object;), ByHqlStatic,
query: 'select ms, m from Membership as ms, Member as m, Field as field
where ms.ownerUuid = :owner and ms.memberUuid =
:member and ms.fieldId = field.uuid and field.name =
:fname and field.typeString = :ftype and
ms.type = :type and ms.memberUuid = m.uuid',
cacheable: false, cacheRegion:
edu .internet2.middleware.grouper.internal.dao.hib3.Hib3MembershipDAO.Fi
ndByOwnerAndMemberAndFieldAndType,
tx type: nullBind var[0]: 'Param (class java.lang.String):
'owner'->'41f8d440-e715-4f9f-809f-2c491165ea62', Bind var[1]: 'Param
(class java.lang.String):
'member'->'4208396d-9b34-4e51-92c2-759b9fa9bb60', Bind var[2]: 'Param
(class java.lang.String): 'fname'->'members', Bind var[3]: 'Param
(class
java.lang.String): 'ftype'->'list'Bind var[4]: 'Param (class
java.lang.String): 'type'->'immediate',
// caused by: org.hibernate.NonUniqueResultException:
// query did not return a unique result: 2

I decided to dig around in the db, since I hadn't seen it's structure
yet. I was suspicious of the member '4208396d-9b34-4e51-92c2-
759b9fa9bb60'.

I soon found some apparent oddness. See this query:

mysql> select name,value,mship_type from grouper_memberships INNER JOIN
grouper_members ON grouper_members.id=grouper_memberships.member_id
INNER JOIN grouper_attributes ON
grouper_attributes.group_id=grouper_memberships.owner_id INNER JOIN
grouper_fields ON grouper_attributes.field_id=grouper_fields.id WHERE
grouper_memberships.member_id='4208396d-9b34-4e51-92c2-759b9fa9bb60'
HAVING grouper_fields.name='name';
+------+----------------------------------------+------------+
| name | value | mship_type |
+------+----------------------------------------+------------+
| name | uc:applications:wireless:eligible | immediate |
| name | uc:applications:wireless:authorized | composite |
| name | uc:applications:cmail:users:eligible | immediate |
| name | uc:applications:cmail:users:eligible | immediate |
| name | uc:applications:cmail:users:authorized | composite |
+------+----------------------------------------+------------+

Could it be the cause of my problem that this group is twice an
immediate member? Here is a fragment of the membership table for that
member (group):

mysql> select owner_id,mship_type,via_id from grouper_memberships
where
member_id = '4208396d-9b34-4e51-92c2-759b9fa9bb60';
+--------------------------------------+------------ +------------------
--------------------+
| owner_id | mship_type | via_id
|
+--------------------------------------+------------ +------------------
--------------------+
| 62b9c697-1af2-47a6-b7ac-90a23602c2ac | immediate | NULL
|
| 20bd10d2-2766-4342-9fd6-c0c5f472603e | composite |
1fb43f92-7457-46e7-906c-ddfc8b0f4129 |
| 41f8d440-e715-4f9f-809f-2c491165ea62 | immediate | NULL
|
| 41f8d440-e715-4f9f-809f-2c491165ea62 | immediate | NULL
|
| 49fe6f6f-7a03-4e69-9ad1-912212407af7 | composite |
f7c157d5-9eb6-4bd7-a82a-d41ba1499e96 |
+--------------------------------------+------------ +------------------
--------------------+
5 rows in set (0.00 sec)


Finally, what could I do to fix this? Unfortunately, I have not found
the cause yet.




Archive powered by MHonArc 2.6.16.

Top of Page