Package com.adaptrex.core.persistence

Examples of com.adaptrex.core.persistence.AdaptrexSession


    return create(entityName, modelData, restOptions, null);
  }

  public static Model create(String entityName, ModelData modelData, RestOptions restOptions, String factoryName) {
    AdaptrexPersistence persistence = Adaptrex.getAdaptrex().getPersistenceManager().getPersistence(factoryName);
    AdaptrexSession session = new AdaptrexSession(persistence);
    Class<?> clazz = persistence.getEntityClass(entityName);
    DataConfig config = new DataConfig(clazz, persistence);
    if (restOptions != null) {
      config.applyRestOptions(restOptions);
    }

    Model model = new Model(session, config);
    model.entity = updateEntity(session, model, modelData);
    session.close();
    return model;
  }
View Full Code Here


    return update(entityName, id, modelData, restOptions, null);
  }

  public static Model update(String entityName, Integer id, ModelData modelData, RestOptions restOptions, String factoryName) {
    AdaptrexPersistence persistence = Adaptrex.getAdaptrex().getPersistenceManager().getPersistence(factoryName);
    AdaptrexSession session = new AdaptrexSession(persistence);
    Class<?> clazz = persistence.getEntityClass(entityName);
    DataConfig config = new DataConfig(clazz, persistence);
    if (restOptions != null) {
      config.applyRestOptions(restOptions);
    }

    Model model = new Model(session, config, id);
    updateEntity(session, model, modelData);
    session.close();
    return model;
  }
View Full Code Here

    return delete(entityName, id, null);
  }

  public static Model delete(String entityName, Integer id, String factoryName) {
    AdaptrexPersistence persistence = Adaptrex.getAdaptrex().getPersistenceManager().getPersistence(factoryName);
    AdaptrexSession session = new AdaptrexSession(persistence);
    Class<?> clazz = persistence.getEntityClass(entityName);
    DataConfig config = new DataConfig(clazz, persistence);
    Model model = new Model(session, config, id);
    persistence.deleteEntity(session, model.getEntity());
    session.close();
    return model;
  }
View Full Code Here

TOP

Related Classes of com.adaptrex.core.persistence.AdaptrexSession

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.