-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Reverse Engineering Not creating object in POJO
PostPosted: Tue Aug 09, 2011 7:07 am 
Newbie

Joined: Mon Oct 24, 2005 6:44 am
Posts: 11
Hi

I am using MYSQL Database.
I having problem adding object to POJO (Class created by Hibernate reverse engineering).
I have two tables customer and title. 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.

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.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
<table-filter match-catalog="PMS1" match-name="stitle"/>
<table-filter match-catalog="PMS1" match-name="customer"/>

<!-- PMS1 schema -->
<table schema="PMS1" name="customer">
<primary-key>
<generator class="native" />
</primary-key>
<foreign-key constraint-name="FK_TitleId">
<many-to-one property="stitle"/>
<set property="customer"/>
</foreign-key>
</table>

<table schema="PMS1" name="stitle">
<primary-key>
<generator class="native" />
</primary-key>
</table>
</hibernate-reverse-engineering>


JAVA object it created

public class Customer implements java.io.Serializable {


private Integer customerId;
private Integer titleId;
private String firstName;

public Customer() {
}


public Integer getCustomerId() {
return this.customerId;
}

public void setCustomerId(Integer customerId) {
this.landlordId = landlordId;
}

public Integer getTitleId() {
return this.titleId;
}

public void setTitleId(Integer titleId) {
this.titleId = titleId;
}
public String getFirstName() {
return this.firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}
}


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


Last edited by ishfady on Tue Aug 09, 2011 10:00 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Reverse Engineering Not creating object in POJO
PostPosted: Tue Aug 09, 2011 8:32 am 
Senior
Senior

Joined: Tue Aug 04, 2009 7:45 am
Posts: 124
I didn't understand whether Stitle.java is generated.
If not - this is a problem, I guess your table named in a different case in Database and filtered by your <table-filter>


Top
 Profile  
 
 Post subject: Re: Reverse Engineering Not creating object in POJO
PostPosted: Tue Aug 09, 2011 10:03 am 
Newbie

Joined: Mon Oct 24, 2005 6:44 am
Posts: 11
Dmitry Geraskov wrote:
I didn't understand whether Stitle.java is generated.
If not - this is a problem, I guess your table named in a different case in Database and filtered by your <table-filter>


I am getting two objects,

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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.