@Override public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException { InternalCDORevision revision = (InternalCDORevision) target; revision.setVersion(((Number) value).intValue()); if (!isVirtualProperty()) { super.set(target, value, factory); } }
@Override public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException { // Do some checking if (value instanceof HibernateMoveableListWrapper) { super.set(target, ((HibernateMoveableListWrapper) value).getDelegate(), factory); return; } if (!(value instanceof PersistentCollection)) { throw new IllegalArgumentException( "Value is not a PersistentCollection but a " + value.getClass().getName()); // $NON-NLS-1$ } if (!(value instanceof List<?>)) { throw new IllegalArgumentException( "Value is not a list but a " + value.getClass().getName()); // $NON-NLS-1$ } // Only set it in the listholder PersistableListHolder.getInstance() .putListMapping(target, getEStructuralFeature(), (PersistentCollection) value); // check if deep inside the persistentlist there is not already a delegate which is a // hibernatemoveable list // which contains the list which should really be set in the cdorevision // persistentlist, hibernatemoveablelistwrapper, real list, if so then the real list should be // set final InternalCDORevision revision = (InternalCDORevision) target; final Object currentValue = revision.getValue(getEStructuralFeature()); if (currentValue == null || !(currentValue instanceof List<?>)) { @SuppressWarnings("unchecked") List<Object> valueList = (List<Object>) value; final WrappedHibernateList whl = new WrappedHibernateList(revision, getEStructuralFeature()); whl.setDelegate(valueList); super.set(target, whl, factory); } }