Hi All,
I am trying to generate pojo from Mapping file.
But When i will ant from command line i am getting the following :-
Buildfile:build.xml run:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2java (Generates a set of .java files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.MappingException: Resource: src\Person.hbm.xml not found BUILD FAILED java.lang.NoClassDefFoundError: org/hibernate/MappingNotFoundException Total time: 0 seconds When i am running with -verbose i am getting everything fine as below:-
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\bea10\jdk150_11\jre
Detected OS: Windows XP
parsing buildfile C:\test\build.xml with URI = file:///C:/test/build.xml
Project base dir set to: C:\test
BUILD SUCCESSFUL
Total time: 0 secondsPlease help me,I can't get what is going on-
I have a folder named test in C:\test
under that my folder st. is as follows:-
test-
|-src
|-Hibernate.cfg.xml
|-Person.hbm.xml
|-lib
|-build.xmlIn lib I have all jar files.
My Build.xml is:-
<project name="test" basedir="." >
<path id="toolslib">
<path location="lib/hibernate-tools.jar" />
<path location="lib/hibernate3.jar" />
<path location="lib/freemarker.jar" />
<path location="lib/ojdbc14.jar" />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<target name="run" description="generate hibernate classes">
<hibernatetool destdir = "${basedir}/src">
<configuration configurationfile="${basedir}/src/hibernate.cfg.xml">
<fileset dir="${basedir}/src">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java jdk5="true"/>
</hibernatetool>
</target>
</project>
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>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:GOLDREF/[email protected]:1521:star</property>
<property name="connection.username">GOLDREF</property>
<property name="connection.password">GOLDREF</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<mapping resource="src\Person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
My Person.hbm.xml is:-
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Person" table="PERSON1">
<id name="id" column="PERSON_ID" type="int">
<generator class="increment"/>
</id>
<property name="age" type="int" column="PERSON_AGE"/>
<property name="firstname" type="java.lang.String" column="PERSON_FIRSTNAME"/>
<property name="lastname" type="java.lang.String" column="PERSON_LASTNAME"/>
<hibernate-mapping>Please help me.......Thanks in advance