Správné pojmenování PU (persistentní jednotky)
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat Mar 14 22:22:46 2009 +0100 (2009-03-14)
changeset 2715acc59d67d
parent 1 55b52df32ec2
child 3 769816825525
Správné pojmenování PU (persistentní jednotky)
java/HibernateDemo1/HibernateDemo1-ejb/src/conf/persistence.xml
java/HibernateDemo1/HibernateDemo1-ejb/src/java/cz/frantovo/hibernateDemo1/CilDAOBean.java
     1.1 --- a/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/persistence.xml	Sat Mar 14 22:14:59 2009 +0100
     1.2 +++ b/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/persistence.xml	Sat Mar 14 22:22:46 2009 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8"?>
     1.5  <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
     1.6 -    <persistence-unit name="POSZ-ejbPU" transaction-type="JTA">
     1.7 +    <persistence-unit name="HibernateDemo1-PU" transaction-type="JTA">
     1.8          <provider>org.hibernate.ejb.HibernatePersistence</provider>
     1.9          <jta-data-source>jdbc/hrisnicispameri</jta-data-source>
    1.10          <exclude-unlisted-classes>false</exclude-unlisted-classes>
     2.1 --- a/java/HibernateDemo1/HibernateDemo1-ejb/src/java/cz/frantovo/hibernateDemo1/CilDAOBean.java	Sat Mar 14 22:14:59 2009 +0100
     2.2 +++ b/java/HibernateDemo1/HibernateDemo1-ejb/src/java/cz/frantovo/hibernateDemo1/CilDAOBean.java	Sat Mar 14 22:22:46 2009 +0100
     2.3 @@ -3,6 +3,8 @@
     2.4  import cz.frantovo.hibernateDemo1.dto.Cil;
     2.5  import java.util.Collection;
     2.6  import javax.ejb.Stateless;
     2.7 +import javax.persistence.EntityManager;
     2.8 +import javax.persistence.PersistenceContext;
     2.9  
    2.10  /**
    2.11   *
    2.12 @@ -10,10 +12,13 @@
    2.13   */
    2.14  @Stateless
    2.15  public class CilDAOBean implements CilDAORemote {
    2.16 +    
    2.17 +    public static final String PU = "HibernateDemo1-PU";
    2.18 +
    2.19 +    @PersistenceContext(unitName = PU)
    2.20 +    private EntityManager em;
    2.21  
    2.22      public Collection<Cil> getCile() {
    2.23          throw new UnsupportedOperationException("Not supported yet.");
    2.24      }
    2.25 -    
    2.26 - 
    2.27  }