File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Need help with Reverse Engineering to create JAVA objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Need help with Reverse Engineering to create JAVA objects" Watch "Need help with Reverse Engineering to create JAVA objects" New topic
Author

Need help with Reverse Engineering to create JAVA objects

Ish Fad
Greenhorn

Joined: Aug 09, 2011
Posts: 4
Hi

I am using MYSQL Database with Eclipse helios.
I am having problem adding object to POJO (Class created by Hibernate reverse engineering).
I have two tables customer and stitle. I have created One-to-Many relationship in MYSQL between this two tables.
titleId is foreign key in customer table. so one to many relation exist.

customer

customerId as int(11) primary Key
titleId as Int(11) foreignKey FK_CTitleId (which is match to titleId in stitle table)
firstname as string(45)

stable

titleId as int(11) primary Key
title as string(45)

When I run reverse engineering, I get two object STitle.java and Customer.java.
Also get two Customer.hbm.xml and Stitle.hbm.xml.
But I am getting titleId in Customer object as an Integer and not as STitle object.

Here is my hibernate-reverse-engineering file.


JAVA object it created



I don't understand why it is creating titleId as integer. It suppose to be object for table sTitle.

Please can someone help me.

Many thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with Reverse Engineering to create JAVA objects