Package org.apache.cayenne

Examples of org.apache.cayenne.DataRow


        List<Artist> objects = context.performQuery(query);
        assertEquals(5, objects.size());

        Artist artist = objects.get(0);
        DataRow snapshot = context.getObjectStore().getSnapshot(artist.getObjectId());
        assertEquals(3, snapshot.size());

        // assert the ordering
        assertEquals("artist1", objects.get(0).getArtistName());
        assertEquals("arTist2", objects.get(1).getArtistName());
        assertEquals("Artist3", objects.get(2).getArtistName());
View Full Code Here


        // just for this test increase pool size
        changeMaxConnections(1);

        try {
            while (it.hasNextRow()) {
                DataRow row = (DataRow) it.nextRow();

                // try instantiating an object and fetching its relationships
                Artist artist = context.objectFromDataRow(Artist.class, row);
                List<?> paintings = artist.getPaintingArray();
                assertNotNull(paintings);
View Full Code Here

        assertTrue(context.hasChanges());
    }

    public void testInvalidateObjects() throws Exception {

        DataRow row = new DataRow(10);
        row.put("ARTIST_ID", new Integer(1));
        row.put("ARTIST_NAME", "ArtistXYZ");
        row.put("DATE_OF_BIRTH", new Date());
        DataObject object = context.objectFromDataRow(Artist.class, row);
        ObjectId oid = object.getObjectId();

        // insert object into the ObjectStore
        context.getObjectStore().registerNode(oid, object);
View Full Code Here

    }

    public void testObjectsUnregistered() throws Exception {
        DataContext context = createDataContext();

        DataRow row = new DataRow(10);
        row.put("ARTIST_ID", new Integer(1));
        row.put("ARTIST_NAME", "ArtistXYZ");
        row.put("DATE_OF_BIRTH", new Date());
        DataObject object = context.objectFromDataRow(Artist.class, row);
        ObjectId oid = object.getObjectId();

        // insert object into the ObjectStore
        context.getObjectStore().registerNode(oid, object);
View Full Code Here

                    }
                }
                break;
            case PersistenceState.HOLLOW:
                if (!refreshObjects) {
                    DataRow cachedRow = cache.getCachedSnapshot(anId);
                    if (cachedRow != null) {
                        row = cachedRow;
                    }
                }
                DataRowUtils.mergeObjectWithSnapshot(
View Full Code Here

        final ClassDescriptor descriptor = getDomain()
                .getEntityResolver()
                .getClassDescriptor("Artist");
        List dataRows = new ArrayList();
        dataRows.add(new DataRow(4));
        dataRows.add(new DataRow(4));

        QueryMetadata metadata = new MockQueryMetadata() {

            @Override
            public ClassDescriptor getClassDescriptor() {
View Full Code Here

        List artists = runProcedureSelect(q);

        // check the results
        assertNotNull("Null result from StoredProcedure.", artists);
        assertEquals(1, artists.size());
        DataRow artistRow = (DataRow) artists.get(0);
        Artist a = ctxt.objectFromDataRow(Artist.class, uppercaseConverter(artistRow));
        Painting p = a.getPaintingArray().get(0);

        // invalidate painting, it may have been updated in the proc
        ctxt.invalidateObjects(Collections.singletonList(p));
View Full Code Here

        List artists = runProcedureSelect(q);

        // check the results
        assertNotNull("Null result from StoredProcedure.", artists);
        assertEquals(1, artists.size());
        DataRow artistRow = (DataRow) artists.get(0);
        Artist a = ctxt.objectFromDataRow(Artist.class, uppercaseConverter(artistRow));
        Painting p = a.getPaintingArray().get(0);

        // invalidate painting, it may have been updated in the proc
        ctxt.invalidateObjects(Collections.singletonList(p));
View Full Code Here

        List artists = runProcedureSelect(q);

        // check the results
        assertNotNull("Null result from StoredProcedure.", artists);
        assertEquals(1, artists.size());
        DataRow artistRow = (DataRow) artists.get(0);
        Artist a = ctxt.objectFromDataRow(Artist.class, uppercaseConverter(artistRow));
        Painting p = a.getPaintingArray().get(0);

        // invalidate painting, it may have been updated in the proc
        ctxt.invalidateObjects(Collections.singletonList(p));
View Full Code Here

        List rows = runProcedureSelect(q);

        // check the results
        assertNotNull("Null result from StoredProcedure.", rows);
        assertEquals(1, rows.size());
        DataRow artistRow = (DataRow) rows.get(0);

        assertEquals(3, artistRow.size());

        artistRow = uppercaseConverter(artistRow);

        Object id = artistRow.get("ARTIST_ID");
        assertNotNull(id);
        assertTrue("Expected Long, got: " + id.getClass().getName(), id instanceof Long);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.DataRow

Copyright © 2018 www.massapicom. 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.