I am trying to generate a POJO class from a hbm.xml file, using Code Generation Dialog (I am completely new to that). Something goes wrong, because I get and error telling that cars.Option class can not be found. That's normal, it can't find the class I am trying to generate. Can anybody explain to me how to do that?.
The mapping file cars/Option.xml:
Code:
<hibernate-mapping package="cars">
<class name="Option" table="OPTIONS">
<id name="id" column="OPTION_ID">
<generator class="native" />
</id>
<property name="optionName" type="string" column="OPTION_NAME" unique="true" not-null="true" />
</class>
</hibernate-mapping>
hibernate.cfg.xml
Code:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/cars</property>
<property name="connection.username">root</property>
<property name="connection.password">password</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<mapping resource="cars/Option.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Option chosen in Code Generation Dialog:
Console Configuration: hiber
Output Directory: \hiber\generated
Use Java 5 Syntax
Domain Code Exporter
The error is "java.lang.ClassNotFoundException cars.Option"