HibernateLayer extends HibernateLayerUtil implements VectorLayer, VectorLayerAssociationSupport,
		VectorLayerLazyFeatureConversionSupport { public void update(Object feature) throws LayerException { Session session = getSessionFactory().getCurrentSession(); session.update(feature); }  @Override String getId(); @Api void setId(String id); @Override CoordinateReferenceSystem getCrs(); @Override FeatureModel getFeatureModel(); @Override boolean useLazyFeatureConversion(); @Api void setUseLazyFeatureConversion(boolean useLazyFeatureConversion); @Api @Override void setLayerInfo(VectorLayerInfo layerInfo); @Override boolean isCreateCapable(); @Override boolean isUpdateCapable(); @Override boolean isDeleteCapable(); @Api void setFeatureModel(FeatureModel featureModel); @Api void setSessionFactory(SessionFactory sessionFactory); Iterator<?> getElements(Filter filter, int offset, int maxResultSize); @Override Object create(Object feature); @Override Object saveOrUpdate(Object feature); @Override void delete(String featureId); @Override Object read(String featureId); void update(Object feature); @Override Envelope getBounds(); Envelope getBounds(Filter filter); @Override List<Attribute<?>> getAttributes(String attributeName, Filter filter); DateFormat getDateFormat(); void setDateFormat(DateFormat dateFormat); boolean isScrollableResultSet(); @Api void setScrollableResultSet(boolean scrollableResultSet);  }
@Test public void testUpdate() throws Exception { HibernateTestFeature f1 = (HibernateTestFeature) layer.create(HibernateTestFeature.getDefaultInstance1(null)); Assert.assertNotNull(f1.getId()); Object feature = layer.read(f1.getId().toString()); Assert.assertNotNull("The requested feature could not be found!", feature); HibernateTestFeature detached = HibernateTestFeature.getDefaultInstance1(null); detached.setId(((HibernateTestFeature) feature).getId()); Map<String, Attribute> attributes = new HashMap<String, Attribute>(); attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name")); attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5f)); Calendar c = Calendar.getInstance(); attributes.put(PARAM_DATE_ATTR, new DateAttribute(c.getTime())); attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false)); attributes.put(PARAM_MANY_TO_ONE, HibernateTestManyToOne.getDefaultAttributeInstance1(null)); layer.getFeatureModel().setAttributes(detached, attributes); layer.saveOrUpdate(detached); feature = layer.read(f1.getId().toString()); Assert.assertEquals("new name", layer.getFeatureModel().getAttribute(feature, PARAM_TEXT_ATTR).getValue()); Assert.assertEquals(5f, layer.getFeatureModel().getAttribute(feature, PARAM_FLOAT_ATTR).getValue()); Assert.assertEquals(c.getTime(), layer.getFeatureModel().getAttribute(feature, PARAM_DATE_ATTR).getValue()); Assert.assertEquals(false, layer.getFeatureModel().getAttribute(feature, PARAM_BOOLEAN_ATTR).getValue()); ManyToOneAttribute manytoOne = (ManyToOneAttribute) layer.getFeatureModel().getAttribute(feature, PARAM_MANY_TO_ONE); Assert.assertNotNull(manytoOne.getValue()); Assert.assertNotNull(manytoOne.getValue().getId()); }