Package com.avaje.tests.model.basic

Examples of com.avaje.tests.model.basic.OCachedBeanChild


     * When deleting a cached entity all entities with a referenced OneToMany relation must also be invalidated!
     */
    @Test
    public void testCacheDeleteOneToMany() {
        // arrange
        OCachedBeanChild child = new OCachedBeanChild();
        OCachedBeanChild child2 = new OCachedBeanChild();

        OCachedBean parentBean = new OCachedBean();
        parentBean.getChildren().add(child);
        parentBean.getChildren().add(child2);
        Ebean.save(parentBean);

        // confirm there are 2 children loaded from the parent
        Assert.assertEquals(2, Ebean.find(OCachedBean.class, parentBean.getId()).getChildren().size());

        // ensure cache has been populated
        Ebean.find(OCachedBeanChild.class, child.getId());
        child2 = Ebean.find(OCachedBeanChild.class, child2.getId());
        parentBean = Ebean.find(OCachedBean.class, parentBean.getId());

        // act
        Ebean.delete(child2);

View Full Code Here

TOP

Related Classes of com.avaje.tests.model.basic.OCachedBeanChild

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.