@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);
	// Create a detached copy
	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));
	// Set a ManyToOne attribute without an ID (a new one)
	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()); // Test for ID
}