Reading the 2012 discussion, my favored approach would be:
-
offer a generic version of get / load
-
ask users to respect Sanne's constraint, i.e. use the @Proxy contract when invoking the methods
-
track the Proxy -> actual class as Steve mentions
We can possibly add a non generic method in some session extension/delegate contract available via unwrap() or a more specific Session method forUntyped(). This might not be as bad considering we also need to support entities provided by name and not class. We could move these "overloaded" contracts (like public Object load(String entityName, Serializable id); to a specific delegate.
|