Skip to content

Instantly share code, notes, and snippets.

@eldermoraes
Created September 21, 2018 15:29
Show Gist options
  • Save eldermoraes/fcaf4b68f4f4a5970141b68c0b88bfd5 to your computer and use it in GitHub Desktop.
Save eldermoraes/fcaf4b68f4f4a5970141b68c0b88bfd5 to your computer and use it in GitHub Desktop.
@Stateless
public class PlayerRankHistoryBean {
@PersistenceContext(unitName = "micro-PU")
private EntityManager em;
public void save(PlayerRankHistory rank){
em.merge(rank);
}
public void remove(PlayerRankHistory rank){
em.remove(findById(rank.getId()));
}
public PlayerRankHistory findById(Long id){
return em.find(PlayerRankHistory.class, id);
}
public List<PlayerRankHistory> findAll(){
return em.createQuery("SELECT r FROM PlayerRankHistory r").getResultList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment