Seam cache provider with ehcache null

Posted by Cateno Viglio on Stack Overflow See other posts from Stack Overflow or by Cateno Viglio
Published on 2009-10-28T16:12:22Z Indexed on 2010/04/01 18:03 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

Hi every one,

I'm trying to configure seam/ehcache following the tutorial from jboss page:

http://docs.jboss.org/seam/2.1.2/reference/en-US/html/cache.html

I put the ehcache.1.2.3.jar in project.ear/lib and injected CacheProvider as especified, but the CacheProvider always return null. The documentation doesn't show any aditional configuration for ehcache, just for jboss cache.

I am probably doing something wrong, it's impossible be so easy :).

besides put the jar in /lib, i created the following seam component to test:

@Scope(ScopeType.SESSION)
@Name("cacheBean")
public class CacheSeamBean implements java.io.Serializable {

 @In(required=false, create=true) 
 private EntityManager em;

 @Logger 
 private Log log;

 @In
 private Events events;

 @In CacheProvider cacheProvider;

 Boolean blLoaded = Boolean.FALSE;

 @Create
 public void buscar() {

  if (!blLoaded){
   List<Parametro> lstParametro = em.createQuery("select p from Parametro p").getResultList();
   for (Parametro parametro : lstParametro){
    cacheProvider.put(parametro.getCodigo(), parametro.getValor());
   }
   blLoaded= Boolean.TRUE;
  }
 }
}

Thanks

© Stack Overflow or respective owner

Related posts about seam

Related posts about ehcache