Bonjour,
Tout d'abord joyeuses fêtes !
J'ai un soucis au lancement de Tomcat 6 avec hibernate :
Erreur sous Eclipse
Classe HibernateUtil
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 ATTENTION: Could not obtain connection metadata java.sql.SQLException: Fonction non prise en charge at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689) at oracle.jdbc.OracleDatabaseMetaData.supportsGetGeneratedKeys(OracleDatabaseMetaData.java:4180) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:123) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at fr.legraverend.stationradio.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
Dans WEB_INF/web.xml
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 public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml " LA LIGNE SUIVANTE EST LA 13 " return new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.out.println(".....................ECHEC....................."); System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
HibernateListener
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <listener> <listener-class>fr.legraverend.stationradio.util.HibernateListener</listener-class> </listener>
hibernate.cfg.xml
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 public class HibernateListener implements ServletContextListener { /* * Just call the static initializer of that class */ public void contextInitialized(ServletContextEvent event) { HibernateUtil.getSessionFactory(); } /* * Free all resources */ public void contextDestroyed(ServletContextEvent event) { HibernateUtil.getSessionFactory().close(); } }
J'utilise donc Oracle 10G, le driver ojbdc14.
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property> <property name="hibernate.connection.password">pass</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@xx.yy.xx.zz:1521:test</property> <property name="hibernate.connection.username">xxx</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property> <property name="hibernate.default_schema">TEST_ADM</property> <property name="show_sql">true</property> <mapping resource="fr/legraverend/stationradio/beans/mapping/Societeradio.hbm.xml"/> <mapping resource="fr/legraverend/stationradio/beans/mapping/Stationradio.hbm.xml"/> </session-factory> </hibernate-configuration>
Je ne comprends pas vraiment cette erreur, mais je crois comprendre qu'il y a un pb de SQL ? Non, il n'y a pas vraiment de rapport à ce stage...
Si quelqu'un peut me venir en aide, je l'en remercie beaucoup d'avance !
Partager