Subversion Repositories bacoAlunos

Rev

Rev 2009 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2009 Rev 2018
Line 1... Line 1...
1
package pt.estgp.es.exemplos.hibernate;
1
package pt.estgp.es.exemplos.hibernate;
2
 
2
 
-
 
3
import java.util.List;
-
 
4
import java.util.Objects;
-
 
5
 
3
public class PaginaImpl extends Pagina {
6
public class PaginaImpl extends Pagina {
-
 
7
 
-
 
8
  public static void main() {
-
 
9
 
-
 
10
    1.5.0/docs/api/java/lang/System.html">System.out.println("new PaginaImpl().getSaveDate().toString() = " + new PaginaImpl().getSaveDate().toString());
-
 
11
 
-
 
12
    HibernateUtils.getCurrentSession().beginTransaction();
-
 
13
 
-
 
14
    Pagina p2 = new PaginaImpl();
-
 
15
    p2.setNome("Teste 2");
-
 
16
    HibernateUtils.getCurrentSession().save(p2);
-
 
17
    HibernateUtils.getCurrentSession().createCriteria(Pagina.class).list();
-
 
18
    List<Pagina> ps = HibernateUtils.getCurrentSession().createCriteria(Pagina.class).list();
-
 
19
 
-
 
20
    for (Pagina p: ps) {
-
 
21
      p.setNome(p.getNome() + " nnn ");
-
 
22
    }
-
 
23
 
-
 
24
    HibernateUtils.getCurrentSession().getTransaction().commit();
-
 
25
  }
4
}
26
}