Ejemplo n.º 1
0
  public void prepare() {
    Configuration cfg = new Configuration();
    cfg.setProperty(Environment.ENABLE_LAZY_LOAD_NO_TRANS, "true");
    cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
    super.prepare(cfg);

    Session s = getFactory().openSession();
    s.beginTransaction();

    WorkOrder wo = new WorkOrder();
    s.persist(wo);

    s.getTransaction().commit();
    s.clear();
    s.close();
  }
  public void prepare() {
    Configuration cfg = new Configuration();
    cfg.setProperty(Environment.ENABLE_LAZY_LOAD_NO_TRANS, "true");
    cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
    super.prepare(cfg);

    Session s = getFactory().openSession();
    s.beginTransaction();

    Entity entity = new Entity();
    entity.setDescription("desc");
    s.persist(entity);
    entityId = entity.getId();

    s.getTransaction().commit();
    s.clear();
    s.close();
  }