I'm using Hibernate Tools 3.2.4.GA to reverse engineer from a MySQL 5.1 database via Ant.
I would like to initialize the
employee attribute in the generated POJO:
Code:
@Entity
@Table(name="user"
,catalog="testdb"
)
public class User implements java.io.Serializable {
private Employee employee;
private String userName;
...
To something like:
Code:
private Employee = new Employee();
I have added the classes folder to the tools classpath but it still doesn't work.
User.hbm.xml:Code:
...
<hibernate-mapping>
<class name="org.app.model.User" table="user" catalog="testdb">
<id name="id" type="string">
<column name="emp_id" length="20" />
<generator class="foreign">
<param name="property">employee</param>
</generator>
</id>
<one-to-one name="employee" class="org.app.model.Employee" constrained="true"></one-to-one>
<property name="userName" type="string">
<column name="usr_userName" length="45" not-null="true" />
</property>
...