use of org.apache.openejb.core.cmp.SimpleKeyGenerator in project tomee by apache.
the class JpaCmpEngine method configureKeyGenerator.
private void configureKeyGenerator(final BeanContext di) throws OpenEJBException {
if (di.isCmp2()) {
di.setKeyGenerator(new Cmp2KeyGenerator());
} else {
final String primaryKeyField = di.getPrimaryKeyField();
final Class cmpBeanImpl = di.getCmpImplClass();
if (primaryKeyField != null) {
di.setKeyGenerator(new SimpleKeyGenerator(cmpBeanImpl, primaryKeyField));
} else if (Object.class.equals(di.getPrimaryKeyClass())) {
di.setKeyGenerator(new SimpleKeyGenerator(cmpBeanImpl, "OpenEJB_pk"));
} else {
di.setKeyGenerator(new ComplexKeyGenerator(cmpBeanImpl, di.getPrimaryKeyClass()));
}
}
}
Aggregations