[MAVEN2] hbm2ddl et hbm2java hibernate
Bonsoir,
Je voudrai à partir de maven faire le schema de ma base de donnée puis ensuite mettre à jour cette base de donnée, mais depuis le debut j'ai des erreus lorsque je lance la commande. J'ai du passé à coté de quelque chose, mais vue que je début je n'arrive pas à voir ...
J'utilise hibernate et ma base de donnée est en postgresql.
A ce que j'ai vue je devrait faire aussi hibernate3:schema-update pour mettre la base à jour.
Si une personne pour m'aider dans tous ce brouillard.
Merci d'avance
Fichier pom.xml
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 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
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ECO</groupId>
<artifactId>ECO</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>ECO</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<jbossHome>${env.JBOSS_HOME}</jbossHome>
<serverName>default</serverName>
<hostName>localhost</hostName>
<port>8080</port>
</configuration>
<goals>
<goal>start</goal>
<goal>stop</goal>
<goal>undeploy</goal>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<executions>
<execution>
<id>hbm2java</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2java</goal>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.1-404.jdbc3</version>
</extension>
</extensions>
</build>
</project> |
Et voici ce que m'affiche la console
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 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
| [INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'hibernate3'.
[INFO] -------------------------------------------------------------------------
---
[INFO] Building ECO
[INFO] task-segment: [hibernate3:hbm2ddl]
[INFO] -------------------------------------------------------------------------
---
[INFO] Preparing hibernate3:hbm2ddl
[WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive invocati
on.
[INFO] Preparing hibernate3:hbm2java
[WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive invocati
on.
[WARNING] Removing: hbm2java from forked lifecycle, to prevent recursive invocat
ion.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] Unable to get resource 'org.codehaus.mojo.hibernate3:maven-hibernate3:
pom:2.0-SNAPSHOT' from repository snapshots (http://snapshots.repository.codehau
s.org)
[WARNING] Unable to get resource 'org.codehaus.mojo.hibernate3:maven-hibernate3:
pom:2.0-SNAPSHOT' from repository codehaus.org (http://repository.codehaus.org)
[WARNING] Unable to get resource 'org.codehaus.mojo.hibernate3:maven-hibernate3:
pom:2.0-SNAPSHOT' from repository codehaus.org (http://repository.codehaus.org)
[INFO] [hibernate3:hbm2java {execution: hbm2java}]
[INFO] using annotationconfiguration task.
[INFO] Configuration XML file loaded: C:\Documents and Settings\llandry\Bureau\U
niv_2007\eclipse\ECOMaven\ECO\src\main\resources\hibernate.cfg.xml
[INFO] Configuration XML file loaded: C:\Documents and Settings\llandry\Bureau\U
niv_2007\eclipse\ECOMaven\ECO\src\main\resources\hibernate.cfg.xml
[INFO] Configuration Properties file loaded: C:\Documents and Settings\llandry\B
ureau\Univ_2007\eclipse\ECOMaven\ECO\src\main\resources\database.properties
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hibernate3:hbm2ddl]
[INFO] Configuration XML file loaded: C:\Documents and Settings\llandry\Bureau\U
niv_2007\eclipse\ECOMaven\ECO\src\main\resources\hibernate.cfg.xml
[INFO] Configuration XML file loaded: C:\Documents and Settings\llandry\Bureau\U
niv_2007\eclipse\ECOMaven\ECO\src\main\resources\hibernate.cfg.xml
[INFO] Configuration Properties file loaded: C:\Documents and Settings\llandry\B
ureau\Univ_2007\eclipse\ECOMaven\ECO\src\main\resources\database.properties
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The dialect was not set. Set the property hibernate.dialect.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.hibernate.HibernateException: The dialect was not set. Set the property hibe
rnate.dialect.
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:649)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:671)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:86)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(H
bm2DDLExporterMojo.java:96)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateE
xporterMojo.java:139)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:420)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Wed Mar 07 02:17:36 CET 2007
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------ |
Pourquoi lorsque je tape la commande hibernate2java, cela ne me crée pas les fichiers java. J'ai bien tous les fichiers hbm.xml et cfg.xml dans /src/resources