Codota Logo
EntityBag.getEntities
Code IndexAdd Codota to your IDE (free)

How to use
getEntities
method
in
com.oberasoftware.jasdb.api.session.EntityBag

Best Java code snippets using com.oberasoftware.jasdb.api.session.EntityBag.getEntities (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/{instanceId}/{bag}")
public String findAll(@PathVariable String instanceId, @PathVariable String bag, Model model) throws JasDBException {
  DBSession session = sessionFactory.createSession(instanceId);
  EntityBag entityBag = session.getBag(bag);
  PageResult result = new PageResult();
  model.addAttribute("page", result);
  if(entityBag != null) {
    QueryResult queryResult = entityBag.getEntities(DEFAULT_PAGE_SIZE);
    result.setEntities(loadEntities(queryResult));
  } else {
    result.setMessage(String.format("Unable to load Bag: %s on instance: %s as it does not exist", bag, instanceId));
  }
  return "data/query";
}
origin: oberasoftware/jasdb

private void testReadBag() throws Exception {
  JasDBMain.start();
  DBSession pojoDb = sessionFactory.createSession();
  EntityBag bag = pojoDb.createOrGetBag("testbag");
  try {
    long startTime = System.currentTimeMillis();
    QueryResult result = bag.getEntities();
    int foundEntities = getResultSize(result);
    
    long endTime = System.currentTimeMillis();
    log.info("Took: {} ms. to read: {} entities from 'testbag'", (endTime - startTime), foundEntities);
    assertEquals("Unexpected number of entities found", NUMBER_ENTITIES + 1, foundEntities);
    
    result = bag.getEntities(20);
    foundEntities = getResultSize(result);
    assertEquals("Unexpected number of entities found", 20, foundEntities);
  } finally {
    JasDBMain.shutdown();
  }
}

origin: oberasoftware/jasdb

@Test
public void testCreateAndInsertEntities() throws JasDBException, IOException {
  DBSession session = sessionFactory.createSession();
  session.addInstance(MY_INSTANCE);
  EntityBag bag = session.createOrGetBag(MY_INSTANCE, BAG_1);
  bag.addEntity(new SimpleEntity().addProperty("test", "value"));
  QueryResult result = bag.getEntities();
  assertThat(result.size(), is(1l));
  Entity entity = result.next();
  assertThat(entity, notNullValue());
  assertThat(entity.getProperty("test").getFirstValue().toString(), is("value"));
}
origin: oberasoftware/jasdb

@Test
public void testInsertOrUpdatePersist() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  EntityBag bag = session.createOrGetBag("insertOrUpdateBag");
  SimpleEntity entity = new SimpleEntity();
  entity.addProperty("Test", "value1");
  String id = bag.persist(entity).getInternalId();
  assertThat(bag.getEntities().size(), is(1L));
  assertThat(bag.getEntity(id).getProperty("Test").getFirstValueObject(), is("value1"));
  SimpleEntity updatedEntity = new SimpleEntity(id);
  updatedEntity.addProperty("AnotherProperty", "AnotherValue");
  bag.persist(updatedEntity);
  assertThat(bag.getEntities().size(), is(1L));
  assertThat(bag.getEntity(id).getProperty("AnotherProperty").getFirstValueObject(), is("AnotherValue"));
}
origin: oberasoftware/jasdb

for(Entity en : bag.getEntities()) {
  log.debug("Loaded entity: {}", en.getInternalId());
  recordsFound++;
com.oberasoftware.jasdb.api.sessionEntityBaggetEntities

Javadoc

Execute a query returning all records in the bag

Popular methods of EntityBag

  • addEntity
    Adds an entity to the bag of entities
  • find
    Builds a query for document in the storage for a specific queryfield with optional sorting parameter
  • getEntity
    Retrieves a specific entity from the bag
  • removeEntity
    Removes the entity from the bag using the id
  • updateEntity
    Updates an entity in the bag of entities
  • ensureIndex
    Ensures there is an index present on a given field in this bag, will create if not existent, will do
  • flush
    Forcibly flushes all the data in the bag to the storage
  • getDiskSize
    Returns the size on the disk of the entities
  • getSize
    Returns the amount of entities in the bag
  • persist
    Persists the provided entity, if not exists will be created, if already exists it will be updated
  • removeIndex
    Removes the index from the bag
  • removeIndex

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now