-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Using EHCache
PostPosted: Mon Aug 17, 2009 8:56 am 
Newbie

Joined: Sun Aug 16, 2009 5:46 pm
Posts: 4
I followed this great article http://www.itsolut.com/chrismusings/2009/06/12/visiting-ehcache/?dzref=192797
But I have some problem when trying to add the entity to the cache by adding the line
Code:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)

I get an error; Type mismatch: cannot convert from Cache to Annotation

Any idea what I missed? Thanks

My code looks like that
Code:

package com.test.hibernate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import net.sf.ehcache.*;

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "keyword", catalog = "test")

public class Keyword implements java.io.Serializable {

   // Fields

   private Integer id;
   private String keyword;
   private Integer type;

   // Constructors

   /** default constructor */
   public Keyword() {
   }

   /** full constructor */
   public Keyword(String keyword, Integer type) {
      this.keyword = keyword;
      this.type = type;
   }

   // Property accessors
   @Id
   @GeneratedValue(strategy = IDENTITY)
   @Column(name = "ID", unique = true, nullable = false)
   public Integer getId() {
      return this.id;
   }

   public void setId(Integer id) {
      this.id = id;
   }

   @Column(name = "Keyword", nullable = false, length = 256)
   public String getKeyword() {
      return this.keyword;
   }

   public void setKeyword(String keyword) {
      this.keyword = keyword;
   }

   @Column(name = "Type", nullable = false)
   public Integer getType() {
      return this.type;
   }

   public void setType(Integer type) {
      this.type = type;
   }

}


Top
 Profile  
 
 Post subject: Re: Using EHCache
PostPosted: Wed Aug 19, 2009 4:22 am 
Newbie

Joined: Sun Aug 16, 2009 5:46 pm
Posts: 4
Someone? Any idea?
Is there no way to use cache with annotation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.