示例#1
0
  // @Test
  public void testInsert_A() {

    AMain a = new AMain("A");

    ASub1 as1 = new ASub1("ASUB1");
    as1.setParent(a);
    a.setOne2oneSubA1(as1);

    genDAO.saveAMain(a);
  }
示例#2
0
  @Test
  public void testInsert_AFamily() {

    // Create the Parent Object.
    AMain a = new AMain("A");

    // One2One Child of AMain, with shared column in both table.
    ASub1 as1 = new ASub1("ASub - 1");
    as1.setParent(a);
    a.setOne2oneSubA1(as1);

    // One2Many Using set, with shared column in both table.
    /*	ASub2 as2a = new ASub2("Set - 1");
    ASub2 as2b = new ASub2("Set - 2");
    as2a.setParent(a);
    as2b.setParent(a);
    Set<ASub2> subSet = new HashSet<ASub2>();
    subSet.add(as2a);
    subSet.add(as2b);
    a.setSubSets(subSet);

    //One2Many using List, with shared column in both table.
    ASub3 as3a = new ASub3("List - 1");
    ASub3 as3b = new ASub3("List - 2");
    ASub3 as3c = new ASub3("List - 3");
    as3a.setParent(a);
    as3b.setParent(a);
    as3c.setParent(a);
    List<ASub3> subList = new ArrayList<ASub3>();
    subList.add(as3a);
    subList.add(as3b);
    subList.add(as3c);
    a.setSubList(subList);*/

    genDAO.saveAMain(a);
  }