Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2
Hibernate tools plugin version:
3.2.2 Beta 1
Mapping documents:
hbmgen.xml
Code:
<?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 package="com.bd.benefitsSignup.entity">
<meta attribute="extends">HistoryEntity</meta>
<meta attribute="implements">Comparable</meta>
</hibernate-mapping>
Name and version of the database you are using:MySql 5
Persistence.xml Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="benefitsSignup">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/benefitsSignupDatasource</jta-data-source>
<mapping-file>hbmgen.hmb.xml</mapping-file>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="none"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/benefitsSignupEntityManagerFactory"/>
</properties>
</persistence-unit>
</persistence>
Generated entity exampleCode:
package com.bd.benefitsSignup.entity;
@Entity
@Table(name = "address", catalog = "bd")
public class Address implements java.io.Serializable {
.......
}
-----
I've been reading through the documentation for the eclipse tools and was trying to implement using the hbm.xml files to control code generation and make every class inherit from a base class that contains common auditing fields. The documentation (
http://docs.jboss.org/tools/2.1.0.Beta1/hibernatetools/html_single/index.html#codegen) shows how to create the hbm.xml file and shows running it via the ant target but doesn't explain how to do this via the Eclipse UI. I have created a console configuration called benefisSignup-ejb and in that I have added the hbmgen.hbm.xml to the Mappings tab. As you can see from the above persistence.xml I have included it there as well.
Unfortunately, it appears that my hbm.xml file is never used because none of the entities are ever generated as extending HistoryEntity or implementing Comparable (just for testing the functionality). Can someone point out to me what I'm doing wrong and/or tell me if there's something I missed about how to do it right?
Thanks,
Drew