Skip to content

GRAILS-9813: Domain.getAll( ['id1','id2'] ) not working : returns null #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
graemerocher opened this issue Feb 4, 2013 · 3 comments
Closed

Comments

@graemerocher
Copy link
Contributor

Original Reporter: syepes
Environment: Not Specified
Version: 2.2
Migrated From: http://jira.grails.org/browse/GRAILS-9813

Hello,

I am facing some kind of issue with the Domain.getAll method, when I try to retrieve a list of instances indicating there ID's I am getting null's:

{code}
Console:
def n = NodeGroups.getAll(['09be28ca-568d-71e2-0ad3-0a031e530000','09bf160e-568d-71e2-0ad3-0a031e530000'])
println n
def n2 = NodeGroups.get('09be28ca-568d-71e2-0ad3-0a031e530000')
println n2

retuls:
[null, null]
09be28ca-568d-71e2-0ad3-0a031e530000
{code}

If we have a look at the hibernate debug info, you can see that it finds the instances but it is still returning null.
Is anyone else facing this issue?

hibernate trace:
{code}
2013-02-04 11:22:27,381 [Thread-16] DEBUG impl.SessionImpl - opened session at timestamp: 5570450830602240

2013-02-04 11:22:27,422 [Thread-16] DEBUG impl.SessionImpl - opened session at timestamp: 5570450831040512

2013-02-04 11:22:27,522 [Thread-16] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)

2013-02-04 11:22:27,522 [Thread-16] DEBUG jdbc.ConnectionManager - opening JDBC connection

2013-02-04 11:22:27,527 [Thread-16] DEBUG hibernate.SQL -
/* criteria query */ select
this_.node_group_id as node1_0_0_,
this_.description as descript2_0_0_,
this_.info as info0_0_,
this_.invisible as invisible0_0_,
this_.label as label0_0_,
this_.node_group_name as node6_0_0_,
this_.parent_id as parent7_0_0_,
this_.symbol_type_id as symbol8_0_0_
from
OPC_NODE_GROUPS this_
where
this_.node_group_id in (
?, ?
)

2013-02-04 11:22:27,824 [Thread-16] DEBUG jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)

2013-02-04 11:22:27,828 [Thread-16] DEBUG loader.Loader - result row: EntityKey[omadmin.NodeGroups#09be28ca-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,843 [Thread-16] DEBUG loader.Loader - result row: EntityKey[omadmin.NodeGroups#09bf160e-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,844 [Thread-16] DEBUG jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)

2013-02-04 11:22:27,844 [Thread-16] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)

2013-02-04 11:22:27,846 [Thread-16] DEBUG engine.TwoPhaseLoad - resolving associations for [omadmin.NodeGroups#09be28ca-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,889 [Thread-16] DEBUG engine.TwoPhaseLoad - adding entity to second-level cache: [omadmin.NodeGroups#09be28ca-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,896 [Thread-16] DEBUG engine.TwoPhaseLoad - done materializing entity [omadmin.NodeGroups#09be28ca-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,896 [Thread-16] DEBUG engine.TwoPhaseLoad - resolving associations for [omadmin.NodeGroups#09bf160e-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,896 [Thread-16] DEBUG engine.TwoPhaseLoad - adding entity to second-level cache: [omadmin.NodeGroups#09bf160e-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,896 [Thread-16] DEBUG engine.TwoPhaseLoad - done materializing entity [omadmin.NodeGroups#09bf160e-568d-71e2-0ad3-0a031e530000]

2013-02-04 11:22:27,896 [Thread-16] DEBUG engine.StatefulPersistenceContext - initializing non-lazy collections

2013-02-04 11:22:27,896 [Thread-16] DEBUG jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!

2013-02-04 11:22:27,898 [Thread-16] DEBUG def.AbstractFlushingEventListener - processing flush-time cascades

2013-02-04 11:22:27,908 [Thread-16] DEBUG def.AbstractFlushingEventListener - dirty checking collections

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.nodes#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.nodes#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policies#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policies#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policyGroups#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policyGroups#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.nodes#09bf160e-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.nodes#09bf160e-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policies#09bf160e-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policies#09bf160e-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policyGroups#09bf160e-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policyGroups#09bf160e-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,915 [Thread-16] DEBUG def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects

2013-02-04 11:22:27,916 [Thread-16] DEBUG def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 6 collections

2013-02-04 11:22:27,917 [Thread-16] DEBUG pretty.Printer - listing entities:

2013-02-04 11:22:27,917 [Thread-16] DEBUG pretty.Printer - omadmin.NodeGroups{parentId=null, policyGroups=, nodeGroupId=09bf160e-568d-71e2-0ad3-0a031e530000, nodes=, invisible=0, description=null, label=MON_TA, symbolTypeId=a5b30a5a-2273-71e2-1220-0a031e530000, nodeGroupName=MON_TA, policies=, info=null}

2013-02-04 11:22:27,917 [Thread-16] DEBUG pretty.Printer - omadmin.NodeGroups{parentId=null, policyGroups=, nodeGroupId=09be28ca-568d-71e2-0ad3-0a031e530000, nodes=, invisible=0, description=null, label=MON_SIS, symbolTypeId=a5b30a5a-2273-71e2-1220-0a031e530000, nodeGroupName=MON_SIS, policies=, info=null}

2013-02-04 11:22:27,918 [Thread-16] DEBUG jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]

2013-02-04 11:22:27,921 [Thread-16] DEBUG jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!

2013-02-04 11:22:27,972 [Thread-16] DEBUG impl.SessionImpl - opened session at timestamp: 5570450833293312

2013-02-04 11:22:27,974 [Thread-16] DEBUG engine.StatefulPersistenceContext - initializing non-lazy collections

2013-02-04 11:22:27,974 [Thread-16] DEBUG jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!

2013-02-04 11:22:27,974 [Thread-16] DEBUG def.AbstractFlushingEventListener - processing flush-time cascades

2013-02-04 11:22:27,974 [Thread-16] DEBUG def.AbstractFlushingEventListener - dirty checking collections

2013-02-04 11:22:27,974 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.nodes#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.nodes#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,974 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policies#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policies#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,974 [Thread-16] DEBUG engine.Collections - Collection found: [omadmin.NodeGroups.policyGroups#09be28ca-568d-71e2-0ad3-0a031e530000], was: omadmin.NodeGroups.policyGroups#09be28ca-568d-71e2-0ad3-0a031e530000

2013-02-04 11:22:27,974 [Thread-16] DEBUG def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects

2013-02-04 11:22:27,975 [Thread-16] DEBUG def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 3 collections

2013-02-04 11:22:27,975 [Thread-16] DEBUG pretty.Printer - listing entities:

2013-02-04 11:22:27,975 [Thread-16] DEBUG pretty.Printer - omadmin.NodeGroups{parentId=null, policyGroups=, nodeGroupId=09be28ca-568d-71e2-0ad3-0a031e530000, nodes=, invisible=0, description=null, label=MON_SIS, symbolTypeId=a5b30a5a-2273-71e2-1220-0a031e530000, nodeGroupName=MON_SIS, policies=, info=null}

2013-02-04 11:22:27,983 [Thread-16] DEBUG impl.SessionImpl - opened session at timestamp: 5570450833338368

2013-02-04 11:22:27,986 [Thread-16] DEBUG impl.SessionImpl - opened session at timestamp: 5570450833350656
{code}

@graemerocher
Copy link
Contributor Author

graemerocher said:
I reverted the change to fix this issue, as it was breaking. As far as I can tell getAll(..) is behaving correctly and it returns nulls in the list for records that were not found. It look though like you are using a custom id (generator/name?) so that may be the problem. If so please attach an example that reproduces the problem.

@graemerocher
Copy link
Contributor Author

tkdrahn said:
I've attached an example in the related issue GPMONGODB-266 which reproduces the problem.

@graemerocher
Copy link
Contributor Author

graemerocher said:
closing as the mongodb issue is fixed, and the change suggested in this issue was a breaking change

@graemerocher graemerocher self-assigned this May 27, 2015
@graemerocher graemerocher added this to the grails-2.1.6 milestone May 27, 2015
jdaugherty pushed a commit that referenced this issue Apr 22, 2025
- Fix Java CI badge
- Add Maven Central badge
- Change links to https
- Change wording
- Remove link to plugin as it is no longer correct with the new plugins page
jdaugherty pushed a commit that referenced this issue Apr 22, 2025
Introduce a new system property, `mongodb.gorm.suite`, to manage the enabling or disabling of specific tests within the TCK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant