Package com.avaje.tests.basic

Source Code of com.avaje.tests.basic.TestLoadBeanCache

package com.avaje.tests.basic;

import java.util.Map;

import org.junit.Assert;
import org.junit.Test;

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.basic.Country;
import com.avaje.tests.model.basic.ResetBasicData;

public class TestLoadBeanCache extends BaseTestCase {

  @Test
  public void testLoad() {
   
    ResetBasicData.reset();
   
    Map<?, Country> map = Ebean.find(Country.class)
      .setLoadBeanCache(true)
      .setUseQueryCache(true)
      .setReadOnly(true)
      .order("name")
      .findMap();
   
    Country loadedNz = map.get("NZ");
   
    // this will hit the cache
    Country nz = Ebean.find(Country.class, "NZ");
   
    Assert.assertTrue(loadedNz == nz);
  }
}
TOP

Related Classes of com.avaje.tests.basic.TestLoadBeanCache

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.