1.1 --- a/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/ClanekDAO.java Sat Jun 19 14:37:11 2010 +0200
1.2 +++ b/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/ClanekDAO.java Sun Jun 20 14:46:47 2010 +0200
1.3 @@ -16,30 +16,30 @@
1.4 @LocalBean
1.5 public class ClanekDAO {
1.6
1.7 - @PersistenceContext(unitName = DAO.PU)
1.8 - private EntityManager em;
1.9 + @PersistenceContext(unitName = DAO.PU)
1.10 + private EntityManager em;
1.11
1.12 - public Clanek getClanek(int id) {
1.13 - return em.find(Clanek.class, id);
1.14 - }
1.15 + public Clanek getClanek(int id) {
1.16 + return em.find(Clanek.class, id);
1.17 + }
1.18
1.19 - public Collection<Clanek> getClanky() {
1.20 - Query dotaz = em.createQuery("FROM " + DAO.t(Clanek.class) + " c ORDER BY id");
1.21 - return dotaz.getResultList();
1.22 - }
1.23 + public Collection<Clanek> getClanky() {
1.24 + Query dotaz = em.createQuery("FROM " + DAO.t(Clanek.class) + " c ORDER BY id");
1.25 + return dotaz.getResultList();
1.26 + }
1.27
1.28 - public int zalozClanek(Clanek clanek) {
1.29 - em.persist(clanek);
1.30 - return clanek.getId();
1.31 - }
1.32 + public int zalozClanek(Clanek clanek) {
1.33 + em.persist(clanek);
1.34 + return clanek.getId();
1.35 + }
1.36
1.37 - public void upravClanek(Clanek clanek) {
1.38 - System.out.println("XXXXXXX: upravuji článek: " + clanek.getId());
1.39 - em.merge(clanek);
1.40 - }
1.41 + public void upravClanek(Clanek clanek) {
1.42 + System.out.println("XXXXXXX: upravuji článek: " + clanek.getId());
1.43 + em.merge(clanek);
1.44 + }
1.45
1.46 - public void smazClanek(Clanek clanek) {
1.47 - clanek = em.merge(clanek);
1.48 - em.remove(clanek);
1.49 - }
1.50 + public void smazClanek(Clanek clanek) {
1.51 + clanek = em.merge(clanek);
1.52 + em.remove(clanek);
1.53 + }
1.54 }