[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5095) BasicLoader.isBag() checks type assignability wrongly

Matt Benson (JIRA) noreply at atlassian.com
Tue May 11 16:49:24 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37055#action_37055 ] 

Matt Benson commented on HHH-5095:
----------------------------------

Heh--good question.  In my particular case I aspect my domain types' collection/map members with an extra interface by dynamically generating proxy objects for incoming values when the fields are set.  Mixing these proxies with Hibernate persistent collections doesn't work because Hibernate expects identity equality for these.  I don't want to alter my Hibernate mappings to use custom collections if I can help it because I have designed this aspecting approach to be non-invasive; with this goal in mind I instead post-process the Hibernate Configuration, dynamically extending the various CollectionType and PersistentCollection subclasses.  This way Hibernate tracks its PersistentCollection instances in the way it expects and I add my additional interface to the PersistentCollections directly, but subclassing BagType is a requirement to make all this work.  :)

> BasicLoader.isBag() checks type assignability wrongly
> -----------------------------------------------------
>
>                 Key: HHH-5095
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5095
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0-Final, 3.5.1
>         Environment: N/A
>            Reporter: Matt Benson
>            Assignee: Gail Badner
>
> Method defined as:
> {code}
> private boolean isBag(CollectionPersister collectionPersister) {
>         return collectionPersister.getCollectionType().getClass().isAssignableFrom( BagType.class );
> }
> {code}
> Will never return true if the returned CollectionType subclasses BagType; should IMO be:
> {code}
> private boolean isBag(CollectionPersister collectionPersister) {
>         return BagType.class.isInstance( collectionPersister.getCollectionType() );
> }
> {code}
> My humble apologies for the submission without a test case, but this one feels pretty simple.  Thanks!

-- 
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