IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

could not execute query


Sujet :

Hibernate Java

  1. #1
    Membre du Club
    Profil pro
    Développeur Java
    Inscrit en
    Juin 2008
    Messages
    86
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Juin 2008
    Messages : 86
    Points : 69
    Points
    69
    Par défaut could not execute query
    J'ai un problème avec hibernate mais je ne sais pas comment il se produit.
    Je pense qu'il à à voir avec les polls de connection.
    Tout fonctionne et après quelques temps je n'arrive plus à realiser aucune requete. je reçois comme erreur 'could not execute query'
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
        JDBC commit failed
    org.hibernate.exception.GenericJDBCException: Cannot open connection
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
          at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
          at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
          at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
          at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
          at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
          at $Proxy12.beginTransaction(Unknown Source)
          at .........
    ........
    Caused by: java.sql.SQLException: Invalid state, the Connection object is closed.
          at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1001)
          at net.sourceforge.jtds.jdbc.ConnectionJDBC2.getAutoCommit(ConnectionJDBC2.java:1160)
          at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:104)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
    voici mon fichier de config
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
     
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
      <session-factory>
            <!-- Database connection settings -->
            <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
     
           <property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/openreservations</property> 
     
            <property name="connection.username">login</property>
            <property name="connection.password">pass</property>
     
          <!-- JDBC connection pool (use the built-in)        -->
            <property name="connection.pool_size">-1</property> 
            <!-- SQL dialect -->
            <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
     
            <!-- Enable Hibernate's automatic session context management -->
            <property name="current_session_context_class">thread</property>
     
            <!-- Disable the second-level cache  -->
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
     
            <!-- Echo all executed SQL to stdout -->
            <property name="show_sql">false</property>
            <!-- Echo all executed SQL to stdout -->
          <mapping resource="be/mxs/mapping/OrTransactions.hbm.xml"/>
     
      </session-factory>
    </hibernate-configuration>

  2. #2
    Membre averti Avatar de sourivore
    Homme Profil pro
    Lead Tech Front-End
    Inscrit en
    Juin 2005
    Messages
    451
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Lead Tech Front-End

    Informations forums :
    Inscription : Juin 2005
    Messages : 451
    Points : 334
    Points
    334
    Par défaut
    Le serveur qui héberge ta BDD doit avoir un problème
    Toi aussi, crée ton armée de soldat de plomb :
    http://souris-bleues.minitroopers.fr/

  3. #3
    Membre du Club
    Profil pro
    Développeur Java
    Inscrit en
    Juin 2008
    Messages
    86
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Juin 2008
    Messages : 86
    Points : 69
    Points
    69
    Par défaut
    Je ne sais pas, Il y a d'autres projets sans hibernate et tout fonctionne correctement.

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    vraisemblablement, dans ton code, tu fait un close de la connection associée à la session, les opérations qui suivent ne peuvent alors pas s'exécuter.

Discussions similaires

  1. Exception "Could not execute query"
    Par ensatTetouan dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 07/06/2012, 13h52
  2. [Data] Could not execute query..
    Par nemo89 dans le forum Spring
    Réponses: 0
    Dernier message: 19/08/2011, 10h49
  3. DetachedCriteria, could not execute query
    Par chine24 dans le forum Persistance des données
    Réponses: 0
    Dernier message: 17/03/2011, 03h16
  4. Réponses: 1
    Dernier message: 30/09/2008, 17h13
  5. could not execute query
    Par nabil148911 dans le forum Hibernate
    Réponses: 3
    Dernier message: 20/07/2007, 14h37

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo