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

SQL Procédural MySQL Discussion :

Video statistics contraintes


Sujet :

SQL Procédural MySQL

  1. #1
    Membre confirmé
    Profil pro
    MOE
    Inscrit en
    Juillet 2007
    Messages
    62
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : MOE

    Informations forums :
    Inscription : Juillet 2007
    Messages : 62
    Par défaut Video statistics contraintes
    Bonsoir



    J' ai une table video qui contient comme champ : id , titre

    et une autre table video_statistics qui contient asset_id, comments_count

    Mon probleme est ce message d'erreur :
    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
    34
    35
    36
    37
    38
      at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343)
            at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:193)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:--- The error occurred in sqlmap/statistics.xml.
    --- The error occurred while applying a parameter map.
    --- Check the createStatisticsForVideo-InlineParameterMap.
    --- Check the statement (update failed).
    --- Cause: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`sohorse/video_statistics`, CONSTRAINT `fk_video_statistics_1` FOREIGN KEY (`asset_id`) REFERENCES `video` (`id`) ON DELETE CASCADE)        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
            at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
            at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
            at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
            at com.sohorse.persistence.sqlmap.VideoDaoImpl.getStats(VideoDaoImpl.java:176)
            ... 44 common frames omitted
    Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`sohorse/video_statistics`, CONSTRAINT `fk_video_statistics_1` FOREIGN KEY (`asset_id`) REFERENCES `video` (`id`) ON DELETE CASCADE)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
            at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
            at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
            at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:794)
            at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:168)
            at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81)
            at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
            at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
            ... 48 common frames omitted
    le probleme vient puisqu
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Unable to find stats of video #1182
    Sachant que la table video ne contient plus cet Id pourtant la table faire tjs reference à lui.



    le code source des tables :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    CREATE TABLE  video (
     
       id int(11) NOT NULL auto_increment,
     
       title varchar(50) NOT NULL,
     
      PRIMARY KEY  (id),
     
      KEY fk_video_1 (owner_id),
     
    ) ENGINE=InnoDB AUTO_INCREMENT=640 DEFAULT CHARSET=utf8;


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    CREATE TABLE  video_statistics (
     
      asset_id int(11) NOT NULL,
     
      comments_count int(11) NOT NULL default 0,
     
      PRIMARY KEY  (asset_id),
     
      CONSTRAINT  fk_video_statistics_1  FOREIGN KEY (asset_id) REFERENCES video (id) ON DELETE CASCADE
     
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

  2. #2
    Membre éclairé Avatar de nicoaix
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Décembre 2004
    Messages
    571
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Décembre 2004
    Messages : 571
    Par défaut
    Il y a visiblement un problème de référence avec les clés de tes tables.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Développement jeux vidéo : quelles bases à avoir absolument ?
    Par Ezechiel dans le forum Développement 2D, 3D et Jeux
    Réponses: 175
    Dernier message: 20/02/2018, 16h14
  2. Réponses: 4
    Dernier message: 18/04/2007, 10h22
  3. [VB6] Affichage d'image avec qlq contraintes
    Par youri dans le forum VB 6 et antérieur
    Réponses: 3
    Dernier message: 21/11/2002, 14h44
  4. [JMF][MediaPlayer] hauteur et largeur de la video
    Par mbp566 dans le forum Multimédia
    Réponses: 3
    Dernier message: 07/08/2002, 15h19
  5. Adresse des polices de caractères dans la RAM video ?
    Par Anonymous dans le forum x86 16-bits
    Réponses: 5
    Dernier message: 27/05/2002, 17h29

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