[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5095?page=c...
]
Matt Benson commented on HHH-5095:
----------------------------------
Well, after reviewing the code in question, isBag(...) is only used locally to determine
whether to throw an exception in the event that more than one bag is part of the same
query, so the only thing I give up by using the released code is a little comfort that
Hibernate will detect this condition. I would assume that this check exists only to
verify that some other code elsewhere in Hibernate hasn't done something it wasn't
supposed to. I will nonetheless make the assertion that if theoretical BagType
subclasses, however unlikely, were truly intended to be excluded here, the original author
would/should have used Class.equals(...) rather than .isAssignableFrom(...).
Regards,
Matt
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira