bonjour,
j'ai utilisé "Hibernate Code Generator Dialog" pour générer mes beans DAO en ayant ce fichier de conf:
Code:
<?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 name="test">
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.password">joe</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/mydb</property>
<property name="hibernate.connection.username">joe</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
</session-factory>
</hibernate-configuration>
au lieu d'utiliser "test", les beans utilisent toujours le nom par defaut "SessionFactory" pour le lookup JNDI.
Code:
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext()
.lookup("SessionFactory");
} catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException(
"Could not locate SessionFactory in JNDI");
}
}
qqun a une idée ?
versions:
Eclipse 3.3.0
hibernate-3.2.5.ga
HibernateTools-3.2.0.GA
JDK 1.5.0.12
Windows XP