Ejemplo n.º 1
0
 public HirundoDatastore() {
   MongoClient mongo = new MongoClient("localhost", 27017);
   Morphia morphia = new Morphia();
   morphia.mapPackage("mongoEntities");
   datastore = morphia.createDatastore(mongo, "hirundo");
   datastore.ensureIndexes();
 }
Ejemplo n.º 2
0
  private MorphiaSingleton() {
    IPropertiesConfiguration configdb =
        FactoryBeans.getInstance(ConfigurationSpring.class).getBean(IPropertiesConfiguration.class);
    mongoClient =
        new MongoClient(
            configdb.getItem(IPropertiesConfiguration.MONGO_DBHOST),
            Integer.valueOf(configdb.getItem(IPropertiesConfiguration.MONGO_DBPORT)));

    morphia = new Morphia();
    morphia.getMapper().getConverters().addConverter(BigDecimalConverter.class);
    morphia.mapPackage("com.paymet.rest.main.db.bean");
    datastore =
        morphia.createDatastore(
            mongoClient, configdb.getItem(IPropertiesConfiguration.MONGO_DBNAME));
    datastore.ensureIndexes();
  }
Ejemplo n.º 3
0
 /**
  * Create Datastore.
  *
  * @param dbName
  * @return
  */
 public Datastore createDataStore(String dbName) {
   return morphia.createDatastore(mongo, dbName);
 }
Ejemplo n.º 4
0
 public MongodbQueryTest() throws UnknownHostException, MongoException {
   mongo = new Mongo();
   morphia = new Morphia().map(User.class).map(Item.class).map(MapEntity.class).map(Dates.class);
   ds = morphia.createDatastore(mongo, dbname);
 }