Examples of NestedOneInMany


Examples of org.geomajas.layer.hibernate.nested.pojo.NestedOneInMany

    Assert.assertNotNull(feature);
  }

  @Test
  public void testExistingOneInMany() throws Exception {
    NestedOneInMany oneInMany1 = new NestedOneInMany();
    oneInMany1.setTextAttr("existing1");
    factory.getCurrentSession().save(oneInMany1);
    factory.getCurrentSession().flush();
   
    Object o = featureModel.newInstance();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    // create many attribute
    OneToManyAttribute many = new OneToManyAttribute(new ArrayList<AssociationValue>());
    // create empty and add
    AssociationValue many1 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    many.getValue().add(many1);
    // create an existing one-in-many and add
    ManyToOneAttribute oneInMany2 = new ManyToOneAttribute();
    AssociationValue oneInManyValue = new AssociationValue(new LongAttribute(oneInMany1.getId()), new HashMap<String, Attribute<?>>(), false);
    oneInMany2.setValue(oneInManyValue);
    AssociationValue many2 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    many2.getAllAttributes().put("oneInMany", oneInMany2);
    many.getValue().add(many2);
    // add many
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.