In IdentifierPolicy, my IdentifierStrategy for entity beans (EJB3)
always are overwritted, this is because an error in the code:
if (strategy == null) {
if (target.getClass().isAnnotationPresent(Identifier.class))
{
Class<? extends IdentifierStrategy> strategyClass =
target.getClass().getAnnotation(Identifier.class).value();
if (strategyClass != IdentifierStrategy.class)
{
try
{
/* ------------------------------------------
here come alive my strategy
------------------------------------------
*/
strategy = strategyClass.newInstance();
strategies.put(target.getClass(), strategy);
}
catch (Exception ex)
{
throw new RuntimeException("Error instantiating IdentifierStrategy for object " + target, ex);
}
}
}
/* ------------------------------------------
here my strategy are killed
------------------------------------------
i think this can correct this ...
if ( strategy == null ) {
*/
for (IdentifierStrategy s : registeredStrategies)
{
if (s.canIdentify(target.getClass()))
{
strategy = s;
strategies.put(target.getClass(), strategy);
break;
}
}
/*
}
*/
}