Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataContext.commitChanges()


        try {
            context.getParentDataDomain().setQueryBuilderFactory(new SoftDeleteQueryBuilderFactory());
           
            final SoftTest test = context.newObject(SoftTest.class);
            test.setName("SoftDeleteBatchQueryBuilderTest");
            context.commitChanges();
           
            final SelectQuery query = new SelectQuery(SoftTest.class);
           
            new ThreadedTestHelper() {
                @Override
View Full Code Here


                }
            }.assertWithTimeout(200);
           
            context.deleteObject(test);
            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
            context.commitChanges();
           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
View Full Code Here

        loadCourses(dataContext);

        // Load student houses data file
        loadStudentHouses(dataContext);

        dataContext.commitChanges();
    }

    private static void loadFile(String filename, DataContext dataContext,
            LineProcessor lineProcessor) throws IOException {
View Full Code Here

                if (list.size() < 60) {
                    dataContext.deleteObjects(list);

                    loadCustomers(dataContext);

                    dataContext.commitChanges();
                }

                loadQuartzJobs(schedulerService);

            } catch (Throwable t) {
View Full Code Here

        Object pk = a.getObjectId().getReplacementIdMap().get(Artist.ARTIST_ID_PK_COLUMN);
        assertNotNull(pk);

        assertEquals(pk, Cayenne.longPKForObject(a));

        context.commitChanges();

        Object pkAfterCommit = a.getObjectId().getIdSnapshot().get(
                Artist.ARTIST_ID_PK_COLUMN);
        assertEquals(pk, pkAfterCommit);
    }
View Full Code Here

        final int nrows = 10;
        for (int i = 0; i < nrows; i++) {
            DataObject o = (DataObject) ctxt.newObject("Painting");
            o.writeProperty("paintingTitle", "ptitle" + i);
        }
        ctxt.commitChanges();

        // create and add new column to model and db
        DbAttribute column = new DbAttribute("NEWCOL2", Types.VARCHAR, dbEntity);

        column.setMandatory(false);
View Full Code Here

        DataContext context = createDataContext();

        for (int i = 0; i < 5; i++) {
            Artist obj = context.newObject(Artist.class);
            obj.setArtistName("a" + i);
            context.commitChanges();
        }
    }

    private void insertPaintValue() {
        DataContext context = createDataContext();
View Full Code Here

            Artist art = context.newObject(Artist.class);
            art.setArtistName("a" + i);
            Painting obj = context.newObject(Painting.class);
            obj.setToArtist(art);
            obj.setPaintingTitle("title" + i);
            context.commitChanges();
        }
    }

    public void testGetExpression() {
        String ejbql = "select a FROM Artist a";
View Full Code Here

            for (int i = 0; i < 5; i++) {
                CayenneDataObject dao = (CayenneDataObject) ctxt.newObject(objEntity
                        .getName());
                dao.writeProperty(oatr1.getName(), "test " + i);
            }
            ctxt.commitChanges();
        }
        finally {
            sourceMap.removeObjEntity(objEntity.getName(), true);
            sourceMap.removeDbEntity(dbEntity.getName(), true);
        }
View Full Code Here

        // this should go away when such mapping becomes fully supported
        target.setDepId(new Integer(1));
        target.setRoot2(src2);

        src.addToDeps(target);
        context.commitChanges();

        context.invalidateObjects(Arrays.asList(src, target, src2));

        ToManyFkRoot src1 = (ToManyFkRoot) Cayenne.objectForPK(context, src
                .getObjectId());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.