if (beanEbi.isReadOnly()) {
return bean;
}
// create a readOnly sharable instance by copying the data
EntityBean sharableBean = desc.createEntityBean();
BeanProperty idProp = desc.getIdProperty();
if (idProp != null) {
Object v = idProp.getValue(bean);
idProp.setValue(sharableBean, v);
}
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
for (int i = 0; i < propertiesNonTransient.length; i++) {
Object v = propertiesNonTransient[i].getValue(bean);
propertiesNonTransient[i].setValue(sharableBean, v);
}
EntityBeanIntercept intercept = sharableBean._ebean_intercept();
intercept.setReadOnly(true);
intercept.setLoaded();
return sharableBean;
}