Hibernate errors

Discussion in 'Java' started by Amira Chelbi, Apr 9, 2011.

  1. Amira Chelbi

    Amira Chelbi

    Joined:
    Apr 9, 2011
    Messages:
    1
    Hi everybody, while executing a test of a DAO class the Junit generated this errors:

    131 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.1.Final
    133 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
    136 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
    140 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    207 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /reservation/src/hibernate.cfg.xml
    207 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /reservation/src/hibernate.cfg.xml

    Here is the DAO class

    package hibernate;

    import java.util.ArrayList;

    import metier.Modele;

    import org.hibernate.Session;

    import dao.DAOModele;

    public class DAOModeleHBM extends DAOHibernate implements DAOModele {
    public void delete(Modele modele) throws Exception {
    Session session = connect();

    session.delete(modele);
    modele.setId(-1);

    close(session);
    }

    public Modele get(int id) throws Exception {
    Modele modele = null;
    Session session = connect();

    modele = (Modele) session.get(Modele.class, id);

    close(session);
    return modele;
    }

    @SuppressWarnings("unchecked")
    public ArrayList<Modele> loadAll() throws Exception {
    ArrayList<Modele> tab = null;
    Session session = connect();

    tab = (ArrayList<Modele>) session.createQuery("FROM modele")
    .list();

    close(session);
    return tab;
    }

    public void save(Modele modele) throws Exception {
    Session session = connect();

    session.save(modele);

    close(session);
    }

    public void update(Modele modele) throws Exception {
    Session session = connect();

    session.update(modele);

    close(session);
    }
    }

    Here is the mapping
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd ">
    <hibernate-mapping>
    <class name="metier.Modele" table="modele" lazy="false">
    <id name="id" type="integer" column="id_modele">
    <generator class="native"/>
    </id>
    <property name="typeMod" type="string" column="typemod"/>
    <property name="bain" type="boolean" column="bain"/>
    <property name="douche" type="boolean" column="douche"/>
    <property name="wc" type="boolean" column="wc"/>
    <property name="nbLitSimple" type="integer" column="nblitsimple"/>
    <property name="nbLitDouble" type="integer" column="nblitdouble"/>
    <property name="television" type="boolean" column="television"/>
    <property name="climatiseur" type="boolean" column="climatiseur"/>
    <property name="fumeur" type="boolean" column="fumeur"/>
    <property name="description" type="boolean" column="description"/>
    <set name="listeChambre" lazy="false" cascade="all">
    <key column="id_modele" />
    <one-to-many class="metier.Chambre"/>
    </set>
    <set name="listeReservation" lazy="false" cascade="all">
    <key column="id_modele" />
    <one-to-many class="metier.Reservation"/>
    </set>
    <set name="listeSaison" table="tarif">
    <key column="id_modele"/>
    <many-to-many column="id_saison"
    class="Saison"/>
    </set>
    </class>

    </hibernate-mapping>

    Here is the Hibernate.cfg.xml file :

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
    <session-factory>
    <property name="connection.url">jdbc:mysql://http://localhost/phpmyadmin/easyreservation</property>
    <property name="connection.username">root</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.password"></property>
    <property name="hibernate.show_sql">true</property>

    <!-- mapping files -->

    <mapping resource="MappingChambre.hbm.xml"/>
    <mapping resource="MappingClient.hbm.xml"/>
    <mapping resource="MappingCompteClient.hbm.xml"/>
    <mapping resource="MappingConferenceBanquet.hbm.xml"/>
    <mapping resource="MappingConsommation.hbm.xml"/>
    <mapping resource="MappingFacture.hbm.xml"/>
    <mapping resource="MappingLigneFacture.hbm.xml"/>
    <mapping resource="MappingModele.hbm.xml"/>
    <mapping resource="MappingPromotionEnfant.hbm.xml"/>
    <mapping resource="MappingPromotionTypeCli.hbm.xml"/>
    <mapping resource="MappingReservation.hbm.xml"/>
    <mapping resource="MappingRestaurant.hbm.xml"/>
    <mapping resource="MappingSaison.hbm.xml"/>
    <mapping resource="MappingSportLoisirs.hbm.xml"/>
    <mapping resource="MappingTarif.hbm.xml"/>
    <mapping resource="MappingTypeConsommation.hbm.xml"/>
    <mapping resource="MappingTypePayement.hbm.xml"/>
    <mapping resource="MappingUtilisateursSys.hbm.xml"/>



    </session-factory>
    </hibernate-configuration>

    Please help me, i need your ideas . Thanks !
     
    Amira Chelbi, Apr 9, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    1,773
    Ilias Lazaridis
    Dec 27, 2004
  2. msenin@covad.net
    Replies:
    0
    Views:
    3,810
    msenin@covad.net
    Jul 14, 2005
  3. jstorta
    Replies:
    1
    Views:
    11,849
    banyvelu@gmail.com
    Jan 19, 2008
  4. Eleanna Skouta
    Replies:
    2
    Views:
    8,513
    Arne Vajhøj
    Dec 9, 2008
  5. Amit Jain
    Replies:
    7
    Views:
    3,394
    Amit Jain
    Apr 27, 2009
Loading...

Share This Page