[hibernate-issues] [Hibernate-JIRA] Created: (HSHARDS-59) selectShardIdsFromShardResolutionStrategyData not finding identifiergenerator for subclasses

Hans Aikema (JIRA) noreply at atlassian.com
Wed Sep 30 09:47:51 EDT 2009


selectShardIdsFromShardResolutionStrategyData not finding identifiergenerator for subclasses
--------------------------------------------------------------------------------------------

                 Key: HSHARDS-59
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-59
             Project: Hibernate Shards
          Issue Type: Bug
    Affects Versions: 3.0.0.Beta2
         Environment: Hibernate 3.2.6-GA, Oracle 10.2.0.3
            Reporter: Hans Aikema
            Assignee: Max Ross


ShardedSessionImpl calls shardedSessionFactory.getIdentifierGenerator with the entity-name from the ShardResolutionData. 

However getIdentifierGenerator is defined in the interface as:
	public IdentifierGenerator getIdentifierGenerator(String rootEntityName);

ShardedSessionImpl should therefor first determine the rootEntityName for the entity at hand and use that entityname to determine the identifiergenerator:

[code]]
IdentifierGenerator idGenerator = shardedSessionFactory.getIdentifierGenerator(srsd.getEntityName());
[/code]

Should be changed to something like

[code]
EntityPersister entityPersister = shardedSessionFactory.getEntityPersister(srsd.getEntityName());
IdentifierGenerator idGenerator = shardedSessionFactory.getIdentifierGenerator(entityPersister.getRootEntityName());
[/code]

This error can be shown when using a superclass with a ShardEncodingIdentifierGenerator. For the subclasses the ShardResolutionStrategy will be consulted to determine the shardId of the object rather than having the ShardEncodingIdentifierGenerator extracting it from the id.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list