@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className='PhenoTips.StudyClass' and p.id=o.id"); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); this.logger.debug("Found {} study properties of type StringListProperty", wrongProperties.size()); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = new DBStringListProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className='PhenoTips.StudyClass' and p.id=o.id"); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); this.logger.debug("Found {} study properties of type StringListProperty", wrongProperties.size()); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = new DBStringListProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className=? and p.id=o.id and p.name=?"); q.setString(0, this.propertyClass.getObject().getName()).setString(1, this.propertyClass.getName()); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = (DBStringListProperty) this.propertyClass.newProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className=? and p.id=o.id and p.name=?"); q.setString(0, this.propertyClass.getObject().getName()).setString(1, this.propertyClass.getName()); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = (DBStringListProperty) this.propertyClass.newProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }