Bonjour,

Je débute en persistence Java. J'ai choisi Hibernate comme solution de reverse-engineering (création des entités Java à partir de mes tables SQL), avec le moins de fichiers de configuration possible (annotations JPA).

Dans un premier temps, j'essaie de générer le code Java grâce aux outils natifs JPA d'Eclipse. Alors que tout semble bien configuré, impossible d'accéder au schéma "public" de ma base :



J'installe alors les JBoss Tools. Ca fonctionne mal, mais je trouve un bricolage pour arranger les choses. Tout est configuré, mais la génération de code ne donne rien, pas un message, pas un fichier !

Comme je suis dans une impasse, je vais tenter de détailler au mieux la configuration de mon projet Eclipse, afin d'arriver à faire fonctionner l'un ou l'autre de ces outils :

Build path



Hibernate settings



JPA settings



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
<?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">org.postgresql.Driver</property>
		<property name="hibernate.connection.password">xxxxxx</property>
		<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/jpa</property>
		<property name="hibernate.connection.username">postgres</property>
		<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
	</session-factory>
</hibernate-configuration>
hibernate.properties
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql://localhost:5432/jpa
hibernate.connection.username=postgres
hibernate.connection.password=xxxxxx
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.reveng.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering />
Database explorer



Hibernate configuration



Hibernate code generator configuration





Merci de votre aide...