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

JPA Java Discussion :

une erreurs au niveaux du transaction


Sujet :

JPA Java

  1. #1
    Membre actif
    Inscrit en
    Août 2007
    Messages
    74
    Détails du profil
    Informations forums :
    Inscription : Août 2007
    Messages : 74
    Par défaut une erreurs au niveaux du transaction
    bonsoir les amis(es) je travaille sur un logiciel d'une gestion de clinique j'ai fait un petit exemple avec des interface a onglets et atout va bien
    mon probleme que aund je vais ajouter une valeur aux tableaux je vais voir des exceptions malgré que ya aps des erreurs dans le programme voici mon programme :
    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
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
     import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    import javax.persistence.Query;
    import javax.swing.table.DefaultTableModel;
     class onglet extends JFrame {
     
              JTabbedPane onglets;
               JPanel onglet1;
        JPanel onglet2;
        JPanel onglet3;
        JPanel onglet4;
        JButton AJOUTER,SUPPRIMER,Modifier,FERMER,ARCHIVE,SAVE;
        JLabel CompteL,CompteL1,CompteL2,NomL,PrenomL,AdresseL,TELL,N_s_sL,MotpasL,DATE_RdvL,HEUR_RDVL,Med_RdvL;
        JTextField NomTF,PrenomTF,AdresseTF,TELTF,N_s_sTF,MotpasTF,AgeTF,DATE_RdvTF,HEUR_RDVTF,Med_RdvTF;
         JTable table=new JTable();
         JTable table1=new JTable();
       JScrollPane sp=new JScrollPane();
        JScrollPane sp1=new JScrollPane();
     
     
     
     
     
        @SuppressWarnings("static-access")
         onglet(){
     
              // panel.setBackground(new Color(240, 169, 86));
                 onglets = new JTabbedPane();
     
     
            onglet1 = new JPanel();
            onglet1.setBackground(new Color(217, 233, 238));
     
     
             AJOUTER=new JButton("AJOUTER");
              AJOUTER= new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/add.png"));
         onglet1.add(AJOUTER);
           onglet1.setLayout(null);
             AJOUTER.setBounds(5,560,100,90);
             AJOUTER.setForeground(new Color(0,0,0));
     
     
              AJOUTER.setBorderPainted(false);
            AJOUTER.setContentAreaFilled(false);
              AJOUTER.addActionListener( new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    AJOUTER();
                }
            });
     
              SUPPRIMER=new JButton("SUPPRIMER");///media/doc/etude/icone/Mashup-MaXo/actions/add.png
              SUPPRIMER= new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/dialog-cancel.png"));
         onglet1.add(SUPPRIMER);
           onglet1.setLayout(null);
             SUPPRIMER.setBounds(230,560,100,90);
             SUPPRIMER.setForeground(new Color(0,0,0));
              SUPPRIMER.setBorderPainted(false);
            SUPPRIMER.setContentAreaFilled(false);
            Modifier=new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/gtk-edit.png"));
         onglet1.add(Modifier);
     
           onglet1.setLayout(null);
             Modifier.setBounds(460,560,100,90);
             Modifier.setForeground(new Color(0,0,0));
              Modifier.setBorderPainted(false);
            Modifier.setContentAreaFilled(false);
             FERMER=new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/system-suspend-hibernate.png"));
         onglet1.add(FERMER);
           onglet1.setLayout(null);
             FERMER.setBounds(640,560,100,90);
             FERMER.setForeground(new Color(0,0,0));
     
              FERMER.setBorderPainted(false);
            FERMER.setContentAreaFilled(false);
            FERMER.addActionListener( new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.exit(0);
     
                }
            });
     CompteL=new JLabel("GESTIONS DES INFIRMIER");
       onglet1.add(CompteL);
           onglet1.setLayout(null);
            CompteL.setBounds(10,15, 700,120);
            CompteL.setForeground(new Color(71,129,172));
            //CompteL.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
             CompteL.setIcon(new javax.swing.ImageIcon("/media/doc/etude/icone/professional-icons/gwil40130.jpg"));
            CompteL.setFont(new Font("Monotype Corsiva",Font.BOLD,30));
     
     
     
             NomL=new JLabel("Nom :");
             onglet1.add(NomL);
     
            onglet1.setLayout(null);
            NomL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            NomL.setForeground(new Color(51,129,172));
            NomL.setBounds(10,140, 100, 30);
     
     
            PrenomL=new JLabel("PRENOM :");
             onglet1.add(PrenomL);
     
            onglet1.setLayout(null);
            PrenomL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            PrenomL.setForeground(new Color(51,129,172));
            PrenomL.setBounds(10,155, 200, 90);
            AdresseL=new JLabel("ADRESSE :");
             onglet1.add(AdresseL);
     
            onglet1.setLayout(null);
            AdresseL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            AdresseL.setForeground(new Color(51,129,172));
            AdresseL.setBounds(10,200, 200, 90);
            TELL=new JLabel("TÉL :");
             onglet1.add(TELL);
     
            onglet1.setLayout(null);
            TELL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            TELL.setForeground(new Color(51,129,172));
            TELL.setBounds(350,140, 100, 30);
             N_s_sL=new JLabel("N.s.s :");
             onglet1.add(N_s_sL);
     
            onglet1.setLayout(null);
            N_s_sL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            N_s_sL.setForeground(new Color(51,129,172));
            N_s_sL.setBounds(350,185, 100, 30);
             MotpasL=new JLabel("MOT_PASSE :");
             onglet1.add(MotpasL);
     
            onglet1.setLayout(null);
            MotpasL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            MotpasL.setForeground(new Color(51,129,172));
            MotpasL.setBounds(350,230, 160, 30);
            NomTF=new JTextField();
     
            NomTF.setBounds(135,140, 180, 27);
            NomTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            NomTF.requestFocus();
     
            PrenomTF=new JTextField();
     
            PrenomTF.setBounds(135, 185, 180, 27);
            PrenomTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            AdresseTF=new JTextField();
     
            AdresseTF.setBounds(135, 230, 180, 27);
            AdresseTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
     
            TELTF=new JTextField();
     
            TELTF.setBounds(500, 140, 180, 27);
            TELTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            N_s_sTF=new JTextField();
     
            N_s_sTF.setBounds(500, 185, 180, 27);
            N_s_sTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            MotpasTF=new JTextField();
     
            MotpasTF.setBounds(500, 230, 180, 27);
            MotpasTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
     
             onglet1.add(NomTF);
             onglet1.add(PrenomTF);
             onglet1.add(AdresseTF);
             onglet1.add(TELTF);
             onglet1.add(N_s_sTF);
             onglet1.add(MotpasTF);
             table.setAutoCreateRowSorter(true); //trier la table
            table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] { },new String [] {"Id", "Nom", "Prénom","Adresse","Tél","N.s.s","mot_passe"}));
            table.getColumnModel().getColumn(0).setPreferredWidth(50);
            table.getColumnModel().getColumn(1).setPreferredWidth(100);
            table.getColumnModel().getColumn(2).setPreferredWidth(100);
            table.getColumnModel().getColumn(3).setPreferredWidth(100);
            table.getColumnModel().getColumn(4).setPreferredWidth(100);
            table.getColumnModel().getColumn(5).setPreferredWidth(100);
            table.getColumnModel().getColumn(6).setPreferredWidth(100);
     
            table.getTableHeader().setFont(new Font("Times New Roman",Font.BOLD,17));
     
            table.getTableHeader().setReorderingAllowed(false);
            table.setRowHeight(22);
            table.setFont(new Font("Times New Roman",Font.BOLD,14));
            table.setOpaque(false);
            table.setForeground(new Color(33,53,105));
            sp.setViewportView(table);
            sp.setBounds(3,270,710,300);
            sp.setOpaque(false);
             onglet1.setLayout(null);
            onglet1.add(sp);
            onglet2 = new JPanel();
            onglet2.setBackground(new Color(171, 233, 198));
     
            CompteL1=new JLabel("GESTIONS DES MEDECINS");
     
       onglet2.add(CompteL1);
     
           onglet2.setLayout(null);
            CompteL1.setBounds(10,15, 700,120);
            CompteL1.setForeground(new Color(71,129,172));
             //CompteL1.setIcon(new javax.swing.ImageIcon("/media/doc/etude/icone/professional-icons/gwil40102.jpg"));
            CompteL1.setFont(new Font("Monotype Corsiva",Font.BOLD,30));
    AJOUTER=new JButton("AJOUTER");
              AJOUTER= new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/add.png"));
         onglet2.add(AJOUTER);
           onglet2.setLayout(null);
             AJOUTER.setBounds(10,60,100,90);
             AJOUTER.setForeground(new Color(0,0,0));
     
              AJOUTER.setBorderPainted(false);
            AJOUTER.setContentAreaFilled(false);
     
     
            onglet3= new JPanel();
            onglet3.setBackground(Color.GREEN);
            onglet4= new JPanel();
            onglet4.setBackground(new Color(190, 247, 208));
            CompteL2=new JLabel("GESTIONS DES RENDEZ-VOUS");
     
       onglet4.add(CompteL2);
       onglet4.setLayout(null);
            CompteL2.setBounds(60,15, 700,120);
            CompteL2.setForeground(new Color(71,129,172));
             CompteL2.setIcon(new javax.swing.ImageIcon("/media/doc/etude/icone/Blogging-Icons-Set/Author/author-48.png"));
            CompteL2.setFont(new Font("Monotype Corsiva",Font.BOLD,30));
            AJOUTER=new JButton("AJOUTER");
              AJOUTER= new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/add.png"));
         onglet4.add(AJOUTER);
           onglet4.setLayout(null);
             AJOUTER.setBounds(0,560,100,90);
             AJOUTER.setForeground(new Color(0,0,0));
     
              AJOUTER.setBorderPainted(false);
            AJOUTER.setContentAreaFilled(false);
             AJOUTER.addActionListener( new ActionListener() {
                public void actionPerformed(ActionEvent e) {
     
                }
            });
              FERMER=new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/system-suspend-hibernate.png"));
         onglet4.add(FERMER);
           onglet4.setLayout(null);
             FERMER.setBounds(630,560,100,90);
             FERMER.setForeground(new Color(0,0,0));
     
              FERMER.setBorderPainted(false);
            FERMER.setContentAreaFilled(false);
            FERMER.addActionListener( new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.exit(0);
     
                }
            });
             SUPPRIMER=new JButton("SUPPRIMER");///media/doc/etude/icone/Mashup-MaXo/actions/add.png
              SUPPRIMER= new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/dialog-cancel.png"));
         onglet4.add(SUPPRIMER);
           onglet4.setLayout(null);
             SUPPRIMER.setBounds(100,560,100,90);
             SUPPRIMER.setForeground(new Color(0,0,0));
              SUPPRIMER.setBorderPainted(false);
            SUPPRIMER.setContentAreaFilled(false);
              Modifier=new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/actions/gtk-edit.png"));
         onglet4.add(Modifier);
     
           onglet4.setLayout(null);
             Modifier.setBounds(220,560,100,90);
             Modifier.setForeground(new Color(0,0,0));
              Modifier.setBorderPainted(false);
            Modifier.setContentAreaFilled(false);
               ARCHIVE=new JButton(new ImageIcon("/media/doc/etude/icone/Blogging-Icons-Set/Archive/archive-48.png"));
         onglet4.add(ARCHIVE);
     
           onglet4.setLayout(null);
             ARCHIVE.setBounds(360,570,80,80);
             ARCHIVE.setForeground(new Color(0,0,0));
              ARCHIVE.setBorderPainted(false);
            ARCHIVE.setContentAreaFilled(false);
    SAVE=new JButton(new ImageIcon("/media/doc/etude/icone/Mashup-MaXo/devices/media-flash.png"));
     SAVE.setBounds(500,570,80,80);
            SAVE.setForeground(new Color(0,0,0));
              SAVE.setBorderPainted(false);
            SAVE.setContentAreaFilled(false);
         onglet4.add(SAVE);
         DATE_RdvL=new JLabel("Date RDV :");
             onglet4.add(DATE_RdvL);
     
            onglet4.setLayout(null);
            DATE_RdvL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            DATE_RdvL.setForeground(new Color(51,129,172));
            DATE_RdvL.setBounds(10,140, 200, 30);
     
             HEUR_RDVL=new JLabel("HEUR RDV:");
             onglet4.add(HEUR_RDVL);
     
            onglet4.setLayout(null);
            HEUR_RDVL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            HEUR_RDVL.setForeground(new Color(51,129,172));
            HEUR_RDVL.setBounds(10,155, 200, 90);
             Med_RdvL=new JLabel("Medecin:");
             onglet4.add(Med_RdvL);
     
            onglet4.setLayout(null);
            Med_RdvL.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
            Med_RdvL.setForeground(new Color(51,129,172));
            Med_RdvL.setBounds(10,200, 230, 90);
             DATE_RdvTF=new JTextField();
     
            DATE_RdvTF.setBounds(240,140, 180, 27);
            DATE_RdvTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            DATE_RdvTF.requestFocus();
     
            HEUR_RDVTF=new JTextField();
     
            HEUR_RDVTF.setBounds(240, 185, 180, 27);
            HEUR_RDVTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
            Med_RdvTF=new JTextField();
     
            Med_RdvTF.setBounds(240, 230, 180, 27);
            Med_RdvTF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
                 onglet4.add( DATE_RdvTF);
             onglet4.add(HEUR_RDVTF);
             onglet4.add(Med_RdvTF);
           onglet4.setLayout(null);
            table1.setAutoCreateRowSorter(true); //trier la table
            table1.setModel(new javax.swing.table.DefaultTableModel(new Object [][] { },new String [] {"Id", "DATE RDV", "HEUR RDV","LE MEDECIN"}));
            table1.getColumnModel().getColumn(0).setPreferredWidth(50);
            table1.getColumnModel().getColumn(1).setPreferredWidth(100);
            table1.getColumnModel().getColumn(2).setPreferredWidth(50);
             table1.getColumnModel().getColumn(2).setPreferredWidth(100);
     
               table1.getTableHeader().setFont(new Font("Times New Roman",Font.BOLD,17));
     
            table1.getTableHeader().setReorderingAllowed(false);
            table1.setRowHeight(22);
            table1.setFont(new Font("Times New Roman",Font.BOLD,14));
            table1.setOpaque(false);
            table1.setForeground(new Color(33,53,105));
            sp1.setViewportView(table1);
            sp1.setBounds(3,270,720,300);
            sp1.setOpaque(false);
             onglet4.setLayout(null);
            onglet4.add(sp1);
     
     onglets.addTab("INFIRMIER",onglet1);
           //AJOUTER.setBounds(100,200,300,40);
     
            onglets.addTab("Medecin",new ImageIcon(""),onglet2);
            onglets.addTab("patient",new ImageIcon("img2MonPanel5.jpg"),onglet3,"info-bulle");
            onglets.addTab("RENDEZ-VOUS",onglet4);
     
             getContentPane().add(onglets);
     
     
     
     
     
     
     
     setDefaultCloseOperation(EXIT_ON_CLOSE);
      setSize(750,700);
      setLocationRelativeTo(null); //pour centrer la fenetre
            setResizable(false);
     
         }
          public static void main(String[] args) {
            JFrame fen =new onglet();
            fen.setVisible(true);
          }
     void AJOUTER(){
            String erreur="";
            if(NomTF.getText().isEmpty())
                erreur+="Nom est vide !\n";
            else
                if(NomTF.getText().length()>25)
                    erreur+="Nom est déppassé 25 caractères !\n";
     
            if(PrenomTF.getText().isEmpty())
                erreur+="Prénom est vide !\n";
            else
                if(PrenomTF.getText().length()>25)
                    erreur+="Prénom est déppassè 25 caractères !";
     
            if(AdresseTF.getText().isEmpty())
                erreur+="Mot de passe est vide !\n";
            else
                if(AdresseTF.getText().length()>25)
                    erreur+="Mot de passe  est déppassé 25 caractères !";
            if(TELTF.getText().isEmpty())
                erreur+="Mot de passe est vide !\n";
            else
                if(TELTF.getText().length()>25)
                    erreur+="Mot de passe  est déppassé 25 caractères !";
            if(N_s_sTF.getText().isEmpty())
                erreur+="Mot de passe est vide !\n";
            else
                if(N_s_sTF.getText().length()>25)
                    erreur+="Mot de passe  est déppassé 25 caractères !";
             if(N_s_sTF.getText().isEmpty())
                erreur+="Mot de passe est vide !\n";
            else
                if(N_s_sTF.getText().length()>25)
                    erreur+="Mot de passe  est déppassé 25 caractères !";
             if(MotpasTF.getText().isEmpty())
                erreur+="Mot de passe est vide !\n";
            else
                if(MotpasTF.getText().length()>25)
                    erreur+="Mot de passe  est déppassé 25 caractères !";
     
            if(erreur.isEmpty()){
                EntityManagerFactory emf = Persistence.createEntityManagerFactory("testinterfPU");
                EntityManager em = emf.createEntityManager();
                EntityTransaction transac = em.getTransaction();
                transac.begin();
                Infermier nouvelleInfermier = new Infermier();
                //nouvelleMedecin.setId(Short.valueOf("9"));
                nouvelleInfermier.setNominf(NomTF.getText());
                nouvelleInfermier.setPrenominf(PrenomTF.getText());
                nouvelleInfermier.setAdresinf(AdresseTF.getText());
                nouvelleInfermier.setS(N_s_sTF.getText());
                nouvelleInfermier.setMotpasse(MotpasTF.getText());
                em.persist(nouvelleInfermier);
                //transac.commit();
                em.close();
                emf.close();
                NomTF.setText("");
                PrenomTF.setText("");
                AdresseTF.setText("");
                N_s_sTF.setText("");
                MotpasTF.setText("");
     
               Filtrage();
            }else
               JOptionPane.showMessageDialog(this,erreur,"Erreur ...",JOptionPane.ERROR_MESSAGE);
        }
      void Filtrage(){
            while(table.getRowCount()>0){
                ((DefaultTableModel)table.getModel()).removeRow(0);
            }
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpaPU");
            EntityManager em = emf.createEntityManager();
            Query query = em.createQuery("select p from Infermier p where p.nominf like :nom and p.prenominf like :prenom and p.adresinf like :adresse and p.telinf like :telephone and p.s like :num securite sociale and p.motpasse like :mot de passe order by p.idinf");
            query.setParameter("nom", NomTF.getText()+"%");
            query.setParameter("prenom", PrenomTF.getText()+"%");
            query.setParameter("adresse",AdresseTF .getText()+"%");
            query.setParameter("num securité sociale",N_s_sTF.getText()+"%");
            query.setParameter("num securité sociale",MotpasTF.getText()+"%");
            java.util.List Nom = query.getResultList();
            Infermier  m=null;
            for (Object Nominf :Nom ) {
                m=(Infermier)Nom;
                Object[] donnee = new Object[]{m.getIdinf(),m.getNominf(),m.getPrenominf(),m.getAdresinf(),m.getS(),m.getTelinf()};
                ((DefaultTableModel)table.getModel()).addRow(donnee);
            }
            em.close();
            emf.close();
     
        }
     
     
     
    }
    et voici les execeptions qui produits
    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
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
     7 janv. 2010 16:56:59 org.hibernate.cfg.annotations.Version <clinit>
    INFO: Hibernate Annotations 3.3.1.GA
    7 janv. 2010 16:56:59 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.2.5
    7 janv. 2010 16:56:59 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    7 janv. 2010 16:56:59 org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : cglib
    7 janv. 2010 16:56:59 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    7 janv. 2010 16:56:59 org.hibernate.ejb.Version <clinit>
    INFO: Hibernate EntityManager 3.3.2.GA
    7 janv. 2010 16:57:02 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
    INFO: Hibernate Validator not found: ignoring
    7 janv. 2010 16:57:02 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    7 janv. 2010 16:57:02 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 20
    7 janv. 2010 16:57:02 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: true
    7 janv. 2010 16:57:02 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/jpa
    7 janv. 2010 16:57:02 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=jpa, password=****, autocommit=true, release_mode=auto}
    7 janv. 2010 16:57:05 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: MySQL, version: 5.0.75-0ubuntu10.2
    7 janv. 2010 16:57:05 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
    7 janv. 2010 16:57:06 org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.MySQLDialect
    7 janv. 2010 16:57:06 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
    7 janv. 2010 16:57:06 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic flush during beforeCompletion(): disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic session close at end of transaction: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch size: 15
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch updates for versioned data: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Scrollable result sets: enabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC3 getGeneratedKeys(): enabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Connection release mode: auto
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Maximum outer join fetch depth: 2
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default batch fetch size: 1
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Generate SQL with comments: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Order SQL updates by primary key: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Order SQL inserts for batching: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
    INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    7 janv. 2010 16:57:06 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
    INFO: Using ASTQueryTranslatorFactory
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JPA-QL strict compliance: enabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Second-level cache: enabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query cache: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory createCacheProvider
    INFO: Cache provider: org.hibernate.cache.NoCacheProvider
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Structured second-level cache entries: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Statistics: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Deleted entity synthetic identifier rollback: disabled
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default entity-mode: pojo
    7 janv. 2010 16:57:06 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Named query checking : enabled
    7 janv. 2010 16:57:06 org.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    7 janv. 2010 16:57:06 org.hibernate.impl.SessionFactoryObjectFactory addInstance
    INFO: Not binding factory to JNDI, no JNDI name configured
    7 janv. 2010 16:57:06 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: Running hbm2ddl schema update
    7 janv. 2010 16:57:06 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: fetching database metadata
    7 janv. 2010 16:57:06 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: updating schema
    7 janv. 2010 16:57:06 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: schema update complete
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Unknown entity: Infermier
            at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)
            at onglet.AJOUTER(onglet.java:428)
            at onglet$1.actionPerformed(onglet.java:53)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253)
            at java.awt.Component.processMouseEvent(Component.java:6108)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3276)
            at java.awt.Component.processEvent(Component.java:5873)
            at java.awt.Container.processEvent(Container.java:2105)
            at java.awt.Component.dispatchEventImpl(Component.java:4469)
            at java.awt.Container.dispatchEventImpl(Container.java:2163)
            at java.awt.Component.dispatchEvent(Component.java:4295)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
            at java.awt.Container.dispatchEventImpl(Container.java:2149)
            at java.awt.Window.dispatchEventImpl(Window.java:2478)
            at java.awt.Component.dispatchEvent(Component.java:4295)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2009
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 4
    Par défaut
    ton exception est la suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Unknown entity: Infermier
    ta classe Infermier est elle une classe entity (avec les annotations @Entity et @Id)?
    si oui, est ce que tu l'a déclarée dans persistence.xml ?

  3. #3
    Membre averti
    Inscrit en
    Août 2009
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Août 2009
    Messages : 49
    Par défaut
    Peut être une erreur ? Ne voulais tu pas mettre infirmier ?

Discussions similaires

  1. Réponses: 4
    Dernier message: 25/04/2012, 11h58
  2. [PDO] transaction validée malgrès une erreur
    Par Alexdezark dans le forum PHP & Base de données
    Réponses: 6
    Dernier message: 30/09/2010, 10h09
  3. Ne pas clore une transaction après une erreur
    Par ArianeV dans le forum PostgreSQL
    Réponses: 1
    Dernier message: 14/04/2008, 13h33
  4. [procédure PG] Une erreur mystérieuse...ou pas
    Par doohan dans le forum PostgreSQL
    Réponses: 2
    Dernier message: 09/07/2003, 17h16
  5. Ne pas formater une erreur
    Par Sylvain Leray dans le forum XMLRAD
    Réponses: 2
    Dernier message: 18/03/2003, 14h13

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