I have Entity A with ID APK having two long fields, that is ids of other entities. So I found Hibernate cache miss while perforning actions add/remove on entity A and to avoid this I want to use Entities instead of long.
@Entity
@AccessType("field")
@Table(name = "A")
@XStreamAlias("A")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class A {
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "x", column = @Column(name = "X_ID")),
@AttributeOverride(name = "y", column = @Column(name = "Y_ID"))})
private APK id;
...................
}
@AccessType("field")
@Embeddable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class APK implements Serializable {
protected long x= 0;//this is id of another entity
protected long y= 0;//this is id of another entity
......
}
YES
P.S.but rhus did not solve cache miss