package org.hibernate.brmeyer.demo.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.Cacheable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @Entity @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class User { @Id @GeneratedValue private long id; private String name; @OneToMany(mappedBy = "assignee") private List<Project> projects = new ArrayList<Project>(); @ManyToMany private List<Skill> skills = new ArrayList<Skill>(); public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Project> getProjects() { return projects; } public void setProjects(List<Project> projects) { this.projects = projects; } public List<Skill> getSkills() { return skills; } public void setSkills(List<Skill> skills) { this.skills = skills; } }