[Hibernate] plusieurs hibernate.cfg.xml
Bonjour,
Une petite question, dans mon appli, je travaille sur 2 bases différentes.
Et qui dit 2 bases dit 2 fichiers de config (hibernate.cfg.xml).
Je génère mes classes et mappings avec hibernate tools.
Et même quand je bascule sur la console, je n'arrive pas voir mes 2 bases.
J'ai le message d'erreur 'An internal error occured during : "Fetching children of BDD".'
J'ai essayé de rajouter dans mon programme java le chemin de mon fichier de config
Code:
1 2 3
| String filePath = new File("systeme/hibernate.cfg.xml").getAbsolutePath();
File file = new File(filePath);
Configuration cfg = new Configuration().configure(file); |
'Configuration' étant org.hibernate.cfg.Configuration.
mais j'ai le message :
Code:
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
| Exception occurred during event dispatching:
java.lang.ExceptionInInitializerError
at systeme.sysutil.AffichUtil.load(AffichUtil.java:75)
at systeme.sysutil.AffichUtil.<init>(AffichUtil.java:56)
at systeme.sysutil.EcranEntrée$EcouteFile.actionPerformed(EcranEntrée.java:128)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
at java.awt.Dialog$1.run(Dialog.java:515)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.RuntimeException: Configuration probleme : /hibernate.cfg.xml not found
at isocial.bdd.HibernateUtil.<clinit>(HibernateUtil.java:26)
... 33 more
Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1265)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1287)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1274)
at isocial.bdd.HibernateUtil.<clinit>(HibernateUtil.java:22)
... 33 more |
Comment résoudre ce problème.
Merci de votre aide.....