Codota Logo
DBSessionFactory.createSession
Code IndexAdd Codota to your IDE (free)

How to use
createSession
method
in
com.oberasoftware.jasdb.api.session.DBSessionFactory

Best Java code snippets using com.oberasoftware.jasdb.api.session.DBSessionFactory.createSession (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/{instanceId}/delete", method = RequestMethod.GET)
public String deleteInstance(@PathVariable String instanceId) throws JasDBException {
  DBSession session = sessionFactory.createSession();
  session.deleteInstance(instanceId);
  return "redirect:/data/";
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/{instanceId}/{bag}/delete", method = RequestMethod.GET)
public String deleteBag(@PathVariable String instanceId, @PathVariable String bag) throws JasDBException {
  DBSession session = sessionFactory.createSession(instanceId);
  session.removeBag(instanceId, bag);
  return "redirect:/data/";
}
origin: oberasoftware/jasdb

@Test(expected = JasDBException.class)
public void testGetNonExistingInstance() throws JasDBException, IOException {
  sessionFactory.createSession("myNotExistingInstance");
}
origin: oberasoftware/jasdb

@RequestMapping(value="/{instanceId}", method = RequestMethod.GET)
public String instanceData(@PathVariable String instanceId, Model model) throws JasDBException {
  DBSession session = sessionFactory.createSession(instanceId);
  model.addAttribute("bags", session.getBags(instanceId));
  return buildIndex(session, model);
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/", method = RequestMethod.POST)
public String createInstance(@Valid WebInstance instance) throws JasDBException {
  DBSession session = sessionFactory.createSession();
  session.addInstance(instance.getName());
  return "redirect:/data/";
}
origin: oberasoftware/jasdb

@RequestMapping(value="/", method=RequestMethod.GET)
public String indexPage(Model model) throws JasDBException {
  DBSession session = sessionFactory.createSession();
  model.addAttribute("bags", session.getBags());
  return buildIndex(session, model);
}
origin: oberasoftware/jasdb

@RequestMapping(value="/{instanceId}/createBag", method = RequestMethod.POST)
public String createBag(Bag bag, @PathVariable String instanceId) throws JasDBException {
  DBSession session = sessionFactory.createSession(instanceId);
  session.createOrGetBag(bag.getName());
  return "redirect:/data/";
}
origin: oberasoftware/jasdb

@Test
public void addInstance() throws JasDBException, IOException {
  DBSession session = sessionFactory.createSession();
  session.addInstance(MY_INSTANCE);
  List<Instance> instanceList = session.getInstances();
  assertEquals(2, instanceList.size());
  session.createOrGetBag(MY_INSTANCE, "testbag");
  File instanceLocation = new File(storageLocation + "/.jasdb/myInstance");
  assertThat(instanceLocation.exists(), is(true));
  assertThat(new File(instanceLocation, "testbag.pjs").exists(), is(true));
}
origin: oberasoftware/jasdb

@Test
public void testBagCreateOrGet() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  session.createOrGetBag("testbag1");
  assertTrue(new File(jasdbHome, "testbag1.pjs").exists());
  assertEquals(1, session.getBags().size());
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/{instanceId}/createEntity", method = RequestMethod.POST)
public String createData(@Valid WebEntity entity, @PathVariable String instanceId) throws JasDBException {
  DBSession session = sessionFactory.createSession(instanceId);
  EntityBag entityBag = session.createOrGetBag(entity.getBag());
  entityBag.addEntity(SimpleEntity.fromJson(entity.getData()));
  return "redirect:/data/";
}
origin: oberasoftware/jasdb

@Test
public void testBagGetNonExisting() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  assertNull(session.getBag("testbag1"));
  assertNull(session.getBag("testbag2"));
  assertEquals(0, session.getBags().size());
  assertFalse(new File(jasdbHome, "testbag1.pjs").exists());
  assertFalse(new File(jasdbHome, "testbag1.pjsm").exists());
  assertFalse(new File(jasdbHome, "testbag2.pjs").exists());
  assertFalse(new File(jasdbHome, "testbag2.pjsm").exists());
}
origin: oberasoftware/jasdb

@Test
public void testGetInstances() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  List<Instance> instanceList = session.getInstances();
  assertEquals(1, instanceList.size());
  Instance instance = instanceList.get(0);
  assertEquals("default", instance.getInstanceId());
  assertEquals(jasdbHome, new File(instance.getPath()).toString());
}
origin: oberasoftware/jasdb

@Test
public void testBagRemove() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  EntityBag bag = session.createOrGetBag("testbag1");
  bag.ensureIndex(new SimpleIndexField("field1", new StringKeyType()), false);
  assertTrue(new File(jasdbHome, "testbag1.pjs").exists());
  assertTrue(new File(jasdbHome, "testbag1_field1ID.idx").exists());
  assertEquals(1, session.getBags().size());
  session.removeBag("testbag1");
  assertFalse(new File(jasdbHome, "testbag1.pjs").exists());
  assertFalse(new File(jasdbHome, "testbag1_field1ID.idx").exists());
}
origin: oberasoftware/jasdb

@Test
public void testGetBagList() throws JasDBException, IOException {
  DBSession session = sessionFactory.createSession();
  session.addAndSwitchInstance(MY_INSTANCE);
  session.createOrGetBag(BAG_1);
  session.createOrGetBag("bag2");
  assertEquals(2, session.getBags().size());
  assertEquals(0, session.getBags("default").size());
  assertEquals(2, session.getBags(MY_INSTANCE).size());
}
origin: oberasoftware/jasdb

@RequestMapping(value = "/{instanceId}/{bag}", method = RequestMethod.POST)
public String searchFieldValue(SearchForm searchForm, @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.find(QueryBuilder.createBuilder().field(searchForm.getField()).value(searchForm.getValue())).limit(DEFAULT_PAGE_SIZE).execute();
    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

@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 testCreateAndGetInstanceBag() throws JasDBException, IOException {
  DBSession session = sessionFactory.createSession();
  session.addInstance(MY_INSTANCE);
  session.createOrGetBag(MY_INSTANCE, BAG_1);
  //default instance should be null
  assertNull(session.getBag(BAG_1));
  assertNotNull(MY_INSTANCE, session.getBag(MY_INSTANCE, BAG_1));
}
origin: oberasoftware/jasdb

@Test
public void testBagFlush() throws JasDBException {
  DBSession session = sessionFactory.createSession();
  EntityBag bag = session.createOrGetBag("testbag");
  long sizeBefore = bag.getDiskSize();
  int TEST_SIZE = 1000;
  for(int i=0; i<TEST_SIZE; i++) {
    bag.addEntity(new SimpleEntity());
  }
  bag.flush();
  assertTrue(bag.getDiskSize() > sizeBefore);
}
origin: oberasoftware/jasdb

@Test
public void testSwitchInstance() throws JasDBException, IOException {
  DBSession session = sessionFactory.createSession();
  session.addInstance(MY_INSTANCE);
  assertEquals("default", session.getInstanceId());
  session.switchInstance(MY_INSTANCE);
  assertEquals(MY_INSTANCE, session.getInstanceId());
  session.addAndSwitchInstance("anotherInstance");
  assertEquals("anotherInstance", session.getInstanceId());
}
origin: oberasoftware/jasdb

@Test
public void testDeleteEmptyIndexValue() throws Exception {
  try {
    DBSession session = sessionFactory.createSession();
    EntityBag bag = session.createOrGetBag("somebag");
    bag.ensureIndex(new SimpleIndexField("field", new StringKeyType()), false);
    String id = bag.addEntity(new SimpleEntity().addProperty("anotherfield", "somevalue")).getInternalId();
    bag.removeEntity(id);
  } finally {
    JasDBMain.shutdown();
  }
}
com.oberasoftware.jasdb.api.sessionDBSessionFactorycreateSession

Javadoc

Creates a DB Session

Popular methods of DBSessionFactory

    Popular in Java

    • Running tasks concurrently on multiple threads
    • scheduleAtFixedRate (Timer)
    • notifyDataSetChanged (ArrayAdapter)
    • scheduleAtFixedRate (ScheduledExecutorService)
      Creates and executes a periodic action that becomes enabled first after the given initial delay, and
    • Format (java.text)
      The base class for all formats. This is an abstract base class which specifies the protocol for clas
    • Comparator (java.util)
      A Comparator is used to compare two objects to determine their ordering with respect to each other.
    • TimerTask (java.util)
      A task that can be scheduled for one-time or repeated execution by a Timer.
    • JarFile (java.util.jar)
      JarFile is used to read jar entries and their associated data from jar files.
    • HttpServlet (javax.servlet.http)
      Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
    • JComboBox (javax.swing)
    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