Skip to content

OracleNoSQL CRUD

xamry edited this page Jul 11, 2013 · 3 revisions

Insert, Find, Update and Remove operations are pure-JPA and are straightforward.

        Person person = new Person();
        person.setPersonId("1");
        person.setPersonName("John Smith");
        person.setAge(32);
        
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("oracle_nosql_pu");
        EntityManager em = emf.createEntityManager();
        
        //Insert data
        em.persist(person);
        
        em.clear();   //Clear cache before finding record
        
        //Search for data
        Person peronFound = em.find(Person.class, "1");        
        
        //Update data
        person.setAge(33);
        em.merge(person);
        
        //Delete data
        em.remove(person);
        
        em.close();
        emf.close();
Previous Home Next
Clone this wiki locally