Package com.force.sdk.codegen.entities

Examples of com.force.sdk.codegen.entities.AccountCustomFields


        deleteAll("Case");
        deleteAll("Opportunity");
        deleteAll(AccountCustomFields.class);
       
        final String name = "Sample Account";
        AccountCustomFields entity = new AccountCustomFields();
        entity.setName(name);
        entity.setSomeCustomField("value1");
       
        persistForceObject(entityManager, entity);

        // First try with find()
        entity = entityManager.find(entity.getClass(), entity.getId());
        assertEquals(entity.getName(), name, "Name did not match.");
       
        // Then try with query()
        List<AccountCustomFields> results = entityManager.createQuery("Select t From AccountCustomFields t").getResultList();
        entity = results.iterator().next();
        assertEquals(entity.getName(), name, "Name did not match.");
       
        // Now we need to make sure update works on MappsedSuperclass entities
        final String newName = "Renamed Sample Account";
        entity.setName(newName);
        mergeForceObject(entityManager, entity);
       
        // Read back upated object
        results = entityManager.createQuery("Select t From AccountCustomFields t where name = ?1")
                                    .setParameter(1, newName).getResultList();
        AccountCustomFields entity1 = results.iterator().next();
        assertEquals(entity1.getId(), entity.getId(), "Ids did not match.");
    }
View Full Code Here


        deleteAll("Case");
        deleteAll("Opportunity");
        deleteAll(AccountCustomFields.class);
       
        final String name = "testEagerlyFetchedOwnerField";
        AccountCustomFields entity = new AccountCustomFields();
        entity.setName(name);
       
        persistForceObject(em, entity);

        EntityTransaction tx = em.getTransaction();
        tx.begin();
        entity = em.find(entity.getClass(), entity.getId());
       
        assertNotNull(entity.getForceOwner(), "Force.com Owner field was not found");
        assertNotNull(entity.getForceOwner().getId(), "Force.com Owner id was not found");
        assertNotNull(entity.getForceOwner().getName(), "Force.com Owner name was not found");
       
        // Assert that the Force.com Owner is in the cache
        ObjectManager om = (ObjectManager) em.getDelegate();
        assertNotNull(om.getObjectFromCache(new StringIdentity(ForceOwner.class, entity.getForceOwner().getId())));
        tx.commit();
       
        // Force.com Owner is eagerly fetched on AccountCustomFields so
        // it should be available outside of the find transaction
        assertNotNull(entity.getForceOwner(), "Force.com Owner field did not get eagerly fetched");
        assertNotNull(entity.getForceOwner().getId(), "Force.com Owner id did not get eagerly fetched");
        assertNotNull(entity.getForceOwner().getName(), "Force.com Owner name did not get eagerly fetched");
    }
View Full Code Here

TOP

Related Classes of com.force.sdk.codegen.entities.AccountCustomFields

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.