Package models

Examples of models.CompositeIdEntity


        a.testId = "Hello from A";
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
        b.testId = "Hello from B";
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

      Map<String, String[]> params = new HashMap<String, String[]>();
      params.put("object.compositeIdForeignA.id", new String[]{a.id.toString()});
      params.put("object.compositeIdForeignB.id", new String[]{b.id.toString()});
    CompositeIdEntity bound = (CompositeIdEntity)Binder.bind("object", CompositeIdEntity.class, CompositeIdEntity.class, null, params);

        Logger.info("1" + e._key());
        Logger.info("2" + bound._key());



    // they have to be the same object
        assertEquals(bound, e);
View Full Code Here


      params.put("object.compositeIdForeignB.id", new String[]{"10000"});
    Object bound = Binder.bind("object", CompositeIdEntity.class, CompositeIdEntity.class, null, params);

        assertTrue(bound instanceof CompositeIdEntity);

    CompositeIdEntity entity = (CompositeIdEntity) bound;
    assertNull(entity.compositeIdForeignA);
    assertNull(entity.compositeIdForeignB);

    assertFalse(entity.isPersistent());
    }
View Full Code Here

    public void testBinderSimple() {
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

      Map<String, String[]> params = new HashMap<String, String[]>();
      params.put("object.id", new String[]{a.id.toString()});
    Object bound = Binder.bind("object", CompositeIdForeignA.class, CompositeIdForeignA.class, null, params);
View Full Code Here

      assertNotNull(factory);
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();
     
    // let's get its key
      Object id = factory.keyValue(e);
      assertNotNull(id);
      assertTrue(id instanceof CompositeIdPk);
View Full Code Here

      assertNotNull(factory);
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

    // let's get its key
      Object id = factory.keyValue(e);
      Model eDB = factory.findById(id);
      assertEquals(e, eDB);
View Full Code Here

        a.testId = "Hello from A";
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
        b.testId = "Hello from B";
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

      Map<String, String[]> params = new HashMap<String, String[]>();
      params.put("object.compositeIdForeignA.id", new String[]{a.id.toString()});
      params.put("object.compositeIdForeignB.id", new String[]{b.id.toString()});
    CompositeIdEntity bound = (CompositeIdEntity)Binder.bind("object", CompositeIdEntity.class, CompositeIdEntity.class, null, params);

        Logger.info("1" + e._key());
        Logger.info("2" + bound._key());



    // they have to be the same object
        assertEquals(bound, e);
View Full Code Here

      params.put("object.compositeIdForeignB.id", new String[]{"10000"});
    Object bound = Binder.bind("object", CompositeIdEntity.class, CompositeIdEntity.class, null, params);

        assertTrue(bound instanceof CompositeIdEntity);

    CompositeIdEntity entity = (CompositeIdEntity) bound;
    assertNull(entity.compositeIdForeignA);
    assertNull(entity.compositeIdForeignB);

    assertFalse(entity.isPersistent());
    }
View Full Code Here

    public void testBinderSimple() {
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

      Map<String, String[]> params = new HashMap<String, String[]>();
      params.put("object.id", new String[]{a.id.toString()});
    Object bound = Binder.bind("object", CompositeIdForeignA.class, CompositeIdForeignA.class, null, params);
View Full Code Here

      assertNotNull(factory);
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();
     
    // let's get its key
      Object id = factory.keyValue(e);
      assertNotNull(id);
      assertTrue(id instanceof CompositeIdPk);
View Full Code Here

      assertNotNull(factory);
      CompositeIdForeignA a = new CompositeIdForeignA();
      a.save();
      CompositeIdForeignB b = new CompositeIdForeignB();
      b.save();
      CompositeIdEntity e = new CompositeIdEntity();
      e.compositeIdForeignA = a;
      e.compositeIdForeignB = b;
      e.save();

    // let's get its key
      Object id = factory.keyValue(e);
      Model eDB = factory.findById(id);
      assertEquals(e, eDB);
View Full Code Here

TOP

Related Classes of models.CompositeIdEntity

Copyright © 2018 www.massapicom. 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.