|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Hibernate3 and mapping resource in hibernate.cfg.xml
Dear All
I am working in a research team on metabolism. I ma trying to use Maven Hibernate3 plugin. I am facing one difficulty. I am not able to generate the java class from reverse engineering. Here the error message 17:31:25,104 INFO org.hibernate.cfg.Configuration - configuring from url: file:/env/export/nfs2/nemo/home/flefevre/new/programs/workspace-jeegalileo/microscope_orm/target/hibernate3/generated-mappings/hibernate.cfg.xmlIt seems that the cfg.xml is not well referencing the hbm.xml files Here the hibernate.cfg.xml <?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">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.password">admagc21NFS</property> <property name="hibernate.connection.url">jdbc:mysql://etna11.genoscope.cns.fr:3306/pkgdb_dev</property> <property name="hibernate.connection.username">agc</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property> <mapping resource="fr/genoscope/agc/microscope/microscopeorm/Amiga.hbm.xml" /> <mapping resource="fr/genoscope/agc/microscope/microscopeorm/GcRegion.hbm.xml" /> </session-factory> </hibernate-configuration> Here one of my hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated Oct 15, 2009 5:27:29 PM by Hibernate Tools 3.2.2.GA --> <hibernate-mapping> <class name="fr.genoscope.agc.microscope.microscopeorm.AfcClass" table="AFC_Class" catalog="pkgdb_dev"> <id name="goId" type="int"> <column name="GO_id" /> <generator class="assigned" /> </id> <property name="SId" type="int"> <column name="S_id" not-null="true" /> </property> <property name="acClass" type="byte"> <column name="AC_class" not-null="true" /> </property> <property name="acCoeff" type="float"> <column name="AC_coeff" precision="12" scale="0" not-null="true" /> </property> </class> </hibernate-mapping> Do you have any idea to solve it? Here my pom.xml Thanks. Francois <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.genoscope.agc.microscope</groupId> <artifactId>microscope_orm</artifactId> <version>0.0.1-SNAPSHOT</version> <description>The concept of Genosphere Project</description> <url>http://villarica.genoscope.cns.fr/mvn/${project.artifactId}</url> <inceptionYear>2009</inceptionYear> <organization> <name>Genoscope</name> <url>http://www.genoscope.cns.fr/</url> </organization> <licenses> <license> <name>Copyright Genoscope</name> <url>LICENSE.txt</url> <distribution>flefevre@...</distribution> <comments>If interest in this project, please contact Francois LE FEVRE, flefevre AT genoscope.cns.fr</comments> </license> </licenses> <developers> <developer> <id>flefevre</id> <name>Francois LE FEVRE</name> <organization>Genoscope</organization> <organizationUrl>http://www.genoscope.cns.fr/agc</organizationUrl> <email>http://mailhide.recaptcha.net/d?k=013tLvh9jN7zlHo24XQyxLt2Nw5-mwbmTh9wgfNDht29JTyxQXS_d8E=</email> <roles> <role>Architect</role> <role>Manager</role> </roles> </developer> </developers> <!-- The issue management system --> <issueManagement> <system>trac</system> <url>http://villarica.genoscope.cns.fr/trac/${project.artifactId}</url> </issueManagement> <!-- Continuous integration process--> <ciManagement> <system>continuum</system> <url>http://villarica.genoscope.cns.fr/continuum</url> <notifiers> <notifier> <type>mail</type> <sendOnError>true</sendOnError> <sendOnFailure>true</sendOnFailure> <sendOnSuccess>true</sendOnSuccess> <sendOnWarning>true</sendOnWarning> <configuration> <address>flefevre@...</address> </configuration> </notifier> </notifiers> </ciManagement> <!-- Project Distribution --> <!-- Should be present only for Continum user --> <distributionManagement> <!-- Configuration to deploy project web site --> <site> <id>Genosphere Maven Server Projects</id> <url> scp://villarica.genoscope.cns.fr/env/cns/genosphere/maven/${project.artifactId} </url> </site> <!-- Configuration to deploy project product ( pom.xml, uml.zip, jar, war, ear into maven repository proxy --> <repository> <id>genoscope</id> <name>Inhouse Internal Release Repository</name> <url> file:///opt/jboss/server/genosphere/data/archiva-repositories/genoscope </url> </repository> <snapshotRepository> <id>snapshots</id> <name>Inhouse Internal Snapshot Repository</name> <url> file:///opt/jboss/server/genosphere/data/archiva-repositories/snapshots </url> <uniqueVersion>false</uniqueVersion> </snapshotRepository> </distributionManagement> <!-- The source code management --> <scm> <connection>scm:svn:http://villarica.genoscope.cns.fr/svn/${project.artifactId}/trunk/</connection> <developerConnection>scm:svn:http://villarica.genoscope.cns.fr/svn/${project.artifactId}/trunk/</developerConnection> <url>scm:svn:http://villarica.genoscope.cns.fr/svn/${project.artifactId}/trunk/</url> </scm> <reporting> <!-- See http://maven.apache.org/plugins/maven-project-info-reports-plugin/index.html * project-info-reports:cim is used to generate the Project Continuous Integration System report. * project-info-reports:dependencies is used to generate the Project Dependencies report. * project-info-reports:dependency-convergence is used to generate the Project Dependency Convergence report for reactor builds. * project-info-reports:dependency-management is used to generate the Project DependencyManagement report. * project-info-reports:index is used to generate the Project index page. * project-info-reports:issue-tracking is used to generate the Project Issue Tracking report. * project-info-reports:license is used to generate the Project License report. * project-info-reports:mailing-list is used to generate the Project Mailing List report. * project-info-reports:plugin-management is used to generate the Project PluginManagement report. * project-info-reports:plugins is used to generate the Project Plugins report. * project-info-reports:project-team is used to generate the Project Team report. * project-info-reports:scm is used to generate the Project Source Code Management report. * project-info-reports:summary is used to generate the Project information reports summary. checkstyle 2.3 2009-07-14 Generate a checkstyle report. SVN JIRA clover 2.4 2007-04-23 Generate a Clover report. NOTE: Moved to Atlassian.com SVN JIRA doap 1.0 2008-08-01 Generate a Description of a Project (DOAP) file from a POM. SVN JIRA docck 1.0 2008-11-16 Documentation checker plugin. SVN JIRA OK javadoc 2.6 2009-07-29 Generate Javadoc for the project. SVN JIRA jxr 2.1 2007-04-05 Generate a source cross reference. SVN JIRA pmd 2.4 2008-01-08 Generate a PMD report. SVN JIRA project-info-reports 2.1.2 2009-07-23 Generate standard project reports. SVN JIRA surefire-report 2.4.3 2008-05-14 Generate a report based on the results of unit tests. --> <plugins> <!-- CHANGE LOG Generate a list of recent changes from your SCM. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> <version>2.0</version> <!-- This version is not working version>2.1</version --> </plugin> <!-- CHANGES Generate a report from issue tracking or a change document. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <configuration> <fromDeveloperId>flefevre</fromDeveloperId> <xmlPath>${basedir}/src/site/resources/changes.xml</xmlPath> <!-- complex query for trac --> <!-- query>status=accepted&status=assigned&status=new&status=reopened&order=priority&component=${project.artifactId}</query --> <tracUser>flefevre</tracUser> <!-- tracPassword>my password</tracPassword--> <!-- smtpHost>smtp.genoscope.cns.fr</smtpHost> <smtpPort implementation="java.lang.Integer">25</smtpPort> <toAddresses> <toAddress implementation="java.lang.String">flefevre@...</toAddress> </toAddresses --> </configuration> <reportSets> <reportSet> <reports> <report>changes-report</report> </reports> </reportSet> </reportSets> <!-- http://maven.apache.org/plugins/maven-changes-plugin/examples/changes-file-validation.html <executions> <execution> <id>validate-changes</id> <phase>pre-site</phase> <goals> <goal>changes-validate</goal> </goals> <configuration> < if set to true the build will fail if the changes file is invalid, if set to false warnings will be logged. > <failOnError>true</failOnError> </configuration> </execution> </executions> --> </plugin> <!-- checkstyle Generate a checkstyle report. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.3</version> </plugin> <!-- JAVADOC --> <plugin> <artifactId>maven-javadoc-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin> <!-- CHANGE LOG FROM SCM --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>changelog-maven-plugin</artifactId> </plugin> <!-- JUNIT REPORT --> <plugin> <artifactId>maven-surefire-plugin</artifactId> </plugin> <!-- TEST COVERAGE --> <plugin> <artifactId>maven-clover-plugin</artifactId> </plugin> <!-- CODE ANALYSIS --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <configuration> <targetjdk>1.5</targetjdk> <rulesets> <ruleset>/rulesets/basic.xml</ruleset> <ruleset>/rulesets/controversial.xml</ruleset> </rulesets> <format>xml</format> <linkXref>true</linkXref> <sourceEncoding>utf-8</sourceEncoding> <minimumTokens>100</minimumTokens> </configuration> </plugin> <!-- RELEASE DOCUMENTATION --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>changes-maven-plugin</artifactId> </plugin> <!-- TODO LIST --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>taglist-maven-plugin</artifactId> </plugin> </plugins> </reporting> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.6.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-tools</artifactId> <version>3.2.3.GA</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <properties> <!-- Database settings (overriden in profiles) --> <hibernate.dialect>org.hibernate.dialect.MySQL5Dialect</hibernate.dialect> <jdbc.groupId>mysql</jdbc.groupId> <jdbc.artifactId>mysql-connector-java</jdbc.artifactId> <jdbc.version>5.1.6</jdbc.version> <jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName> <jdbc.url>jdbc:mysql://etna11.genoscope.cns.fr:3306/pkgdb_dev</jdbc.url> <jdbc.username>agc</jdbc.username> <jdbc.password>admagc21NFS</jdbc.password> </properties> <build> <extensions> <extension> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </extension> </extensions> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> <!-- executions> <execution> <id>create-hibernate-configuration</id> <phase>generate-resources</phase> <goals> <goal>hbm2cfgxml</goal> <goal>hbm2hbmxml</goal> </goals> </execution> <execution> <id>create-hibernate-classes</id> <phase>process-resources</phase> <goals> <goal>hbm2java</goal> </goals> </execution> </executions--> <configuration> <components> <!-- component> <name>hbmtemplate</name> </component--> <!-- Generates a hibernate.cfg.xml file based on an existing database schema. You would use this goal to build a Hibernate configuration from an existing database. --> <component> <name>hbm2cfgxml</name> <implementation>jdbcconfiguration</implementation> <!-- outputDirectory>target/hibernate3/generated-mappings</outputDirectory--> </component> <component> <name>hbm2hbmxml</name> <implementation>jdbcconfiguration</implementation> <!-- outputDirectory>target/hibernate3/generated-mappings</outputDirectory--> </component> <component> <name>hbm2java</name> <!--implementation>configuration</implementation--> <implementation>annotationconfiguration</implementation> <!-- outputDirectory>target/hibernate3/generated-sources</outputDirectory--> </component> </components> <componentProperties> <template>src/main/resources/CustomPojo.ftl</template> <!-- implementation></implementation--> <configurationfile>/target/hibernate3/generated-mappings/hibernate.cfg.xml</configurationfile> <!-- propertyfile>/src/main/config/hibernate-mysql.properties</propertyfile--> <entityresolver>org.xml.sax.EntityResolver</entityresolver> <namingstrategy>org.hibernate.cfg.DefaultNamingStrategy</namingstrategy> <!-- persistenceunit></persistenceunit--> <packagename>fr.genoscope.agc.microscope.microscopeorm</packagename> <!-- revengfile></revengfile> <reversestrategy></reversestrategy --> <detectmanytomany>true</detectmanytomany> <detectoptmisticlock>true</detectoptmisticlock> <export>false</export> <update>false</update> <drop>false</drop> <create>false</create> <!-- outputfilename></outputfilename> <delimiter>;</delimiter> <format>false</format --> <jdk5>false</jdk5> <ejb3>false</ejb3> <!-- filepattern></filepattern> <template></template> <templatepath></templatepath> <exporterclass></exporterclass --> </componentProperties> </configuration> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> </dependencies> </plugin> <!-- WEB SITE GENERATION --> <plugin> <artifactId>maven-site-plugin</artifactId> <configuration> <locales>en,fr</locales> </configuration> </plugin> <!-- COMPILATION --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> </project> --
--
Francois
LE FEVRE
Ingenieur / Chercheur Email: flefevre@... Tel: 33 (0)1 60 87 45 83 CEA / DSV / FAR / IG / Genoscope / LBIR (French Atomic Energy Commission) Website: http://www.genoscope.cns.fr/bioinfo/ Mail: 2 rue Gaston Cremieux, 91057 Evry, France |
|
|
Re: Hibernate3 and mapping resource in hibernate.cfg.xml
Dear all,
I have found the solution. I forgot to put my hbm in a resource forlder in order that they are included in the classpath. Thanks you. Francois Dear All --
--
Francois
LE FEVRE
Ingenieur / Chercheur Email: flefevre@... Tel: 33 (0)1 60 87 45 83 CEA / DSV / FAR / IG / Genoscope / LBIR (French Atomic Energy Commission) Website: http://www.genoscope.cns.fr/bioinfo/ Mail: 2 rue Gaston Cremieux, 91057 Evry, France |
| Free embeddable forum powered by Nabble | Forum Help |