0

My peristance file is:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="jpa" transaction-type="RESOURCE_LOCAL">
        <!-- provider -->
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>sau.se.migration.model.TGridStation</class>
        <class>sau.se.domain.model.Graph</class>
        <class>sau.se.domain.model.Role</class>
        <class>sau.se.domain.model.StationPrincipale</class>
        <class>sau.se.domain.model.StationSecondaire</class>
        <class>sau.se.domain.model.User</class>
        <class>sau.se.domain.model.Incident</class>
        <class>sau.se.domain.model.Listes</class>
        <class>sau.se.domain.model.Vip</class>
        <class>sau.se.domain.model.Feeder</class>
        <properties>
            <!-- Classes persistantes -->
            <!--<property name="hibernate.archive.autodetection" value="class, hbm" 
                /> -->
            <!-- logs SQL -->
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.format_sql" value="true" />
            <property name="use_sql_comments" value="true" />
            <!-- connexion JDBC -->
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
            <property name="hibernate.connection.url"
                value="jdbc:mysql://localhost/semap?zeroDateTimeBehavior=convertToNull" />
            <property name="hibernate.connection.useUnicode" value="true" />
            <property name="hibernate.connection.characterEncoding"
                value="UTF-8" />
            <property name="hibernate.connection.charSet" value="UTF-8" />
            <property name="hibernate.connection.username" value="root" />
            <property name="hibernate.connection.password" value="123456789" />
            <!-- Dialecte -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
    </persistence-unit>
</persistence>

And I am quiet sure that it is the only configuration file in my project because I tried to put wrong password and I got the expected error on connection.

I want to change semap db name to any other but in vain. Is there any other configuration that I don't know?

UPDATE The real problem is that my application is still working with semap db (the old one)

Aritz
  • 30,971
  • 16
  • 136
  • 217
Houssam Badri
  • 2,441
  • 3
  • 29
  • 60
  • 1
    I quiet don't understand your problem. But I guess Hibernate doesn't create database for you, it can created tables for you. So if you have changed the DB and you don't have your database named semap created then you will get exception. Change the database name in mysql and provide the new name in the connection url. – Bilbo Baggins Jul 02 '14 at 12:01
  • 1
    Please post the Exception you encounter and also verify (may sound trivial) if the database to which you want to switch exists and is reachable – Bond - Java Bond Jul 02 '14 at 12:18
  • @SamwiseGamgee I manually created the db – Houssam Badri Jul 02 '14 at 12:23
  • @JavaBond yes the db exists and it is reachable – Houssam Badri Jul 02 '14 at 12:24
  • @HoussemBdr ok. please post the exception stack trace – Bond - Java Bond Jul 02 '14 at 12:27
  • @JavaBond see the update plz, I should be more clear – Houssam Badri Jul 02 '14 at 12:46
  • 1
    Are you using Spring or similars to manage your JPA layer? Anyway, this problem has an easy fix. Just open your favourite IDE and search for the old database url in all your config files. If it doesn't appear, it must be you're deploying an old compilation. – Aritz Jul 02 '14 at 18:36

0 Answers0