[
https://hibernate.onjira.com/browse/HHH-7166?page=com.atlassian.jira.plug...
]
William Burns commented on HHH-7166:
------------------------------------
Java allows for method return type covariance, which would limit this breaking their code.
The only problem would be if they invoked the super method and assigned it to a variable
the is defined as the implementation class instead of the interface. But you would know
better if that is what they are doing.
Should I log an improvement for a later release then?
Infinispan Hibernate RegionFactory doesn't allow user to have
their own custom CommandFactory
---------------------------------------------------------------------------------------------
Key: HHH-7166
URL:
https://hibernate.onjira.com/browse/HHH-7166
Project: Hibernate ORM
Issue Type: Bug
Affects Versions: 4.1.1
Reporter: William Burns
Assignee: Galder Zamarreno
Fix For: 4.1.2
Attachments: 0001-Changed-command-factory-lookup-to-only-grab-the-hibe.patch
The hibernate infinispan module currently takes the first command factory returned.
{code}
// TODO: This is a hack, make it easier to retrieve in Infinispan!
return (CacheCommandFactory) ((Map)
globalCr.getComponent("org.infinispan.modules.command.factories"))
.values().iterator().next();
{code}
This assumes that the hibernate infinispan command factory is the only one provided. If
a user has their own command factory and attempts to use hibernate there is a chance that
it will grab the incorrect command factory eventually causing a ClassCastException.
I have attached a patch that contains a simple fix, where basically it iterates through
the factories and only pulls out the hibernate one.
There is also a small change that I changed the return type for the
TransactionManagerLookup to use the interface instead of the hibernate specific one. This
way it is easier for users to override the method.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira