In Continuation to apache-ignite-integration-as-hibernate-2nd-level-cache-not-starting
I am making use of annotation
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "userType" in my Entity:
import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.Table; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @Entity @Table(name = "USER_TYPE", indexes = { @Index(columnList = "TYPE_SHORT_NAME", name = "TYPE_SHORT_NAME_UNIQUE_idx", unique = true), }) @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "userType") public class UserType implements Serializable { private static final long serialVersionUID = -628308304752474026L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "USER_TYPE_ID") private int userTypeId; @Column(name = "TYPE_SHORT_NAME", length = 20, nullable = false) private String typeShortName; @Column(name = "TYPE_LONG_NAME", length = 255) private String typeLongName; public UserType() { } public UserType(int userTypeId, String typeShortName, String typeLongName) { this.userTypeId = userTypeId; this.typeShortName = typeShortName; this.typeLongName = typeLongName; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((typeLongName == null) ? 0 : typeLongName.hashCode()); result = prime * result + ((typeShortName == null) ? 0 : typeShortName.hashCode()); result = prime * result + userTypeId; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof UserType)) return false; UserType other = (UserType) obj; if (typeLongName == null) { if (other.typeLongName != null) return false; } else if (!typeLongName.equals(other.typeLongName)) return false; if (typeShortName == null) { if (other.typeShortName != null) return false; } else if (!typeShortName.equals(other.typeShortName)) return false; if (userTypeId != other.userTypeId) return false; return true; } @Override public String toString() { return "UserType [userTypeId=" + userTypeId + ", typeShortName=" + typeShortName + ", typeLongName=" + typeLongName + "]"; } public int getUserTypeId() { return userTypeId; } public void setUserTypeId(int userTypeId) { this.userTypeId = userTypeId; } public String getTypeShortName() { return typeShortName; } public void setTypeShortName(String typeShortName) { this.typeShortName = typeShortName; } public String getTypeLongName() { return typeLongName; } public void setTypeLongName(String typeLongName) { this.typeLongName = typeLongName; } } But still in need to add this in ignite-configuration.
<bean parent="transactional-cache"> <property name="name" value="userType"/> </bean> Are annotations not supported in ignite-cache? Why do we need to implement this in ignite-configuration?