BeanEntityMapper implements  EntityMapper { public Entity asEntity(Object object) { return new BeanEntity(object); }  Entity findOrCreateEntity(String dataSourceName, Object id); Entity asEntity(Object object);  }
@Test public void testAsEntity() throws LayerException { BeanEntityMapper mapper = new BeanEntityMapper(); FeatureBean bean = new FeatureBean(); bean.setId(3L); ManyToOneAttributeBean many = new ManyToOneAttributeBean(); many.setId(4L); bean.setManyToOneAttr(many); Entity entity = mapper.asEntity(bean); Assert.assertEquals(new Long(3L), entity.getId("id")); Assert.assertEquals(new Long(4L), entity.getChild("manyToOneAttr").getId("id")); }