-->
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.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Reverse Engineering Hibernate Tools 3.1.0beta1
PostPosted: Wed Nov 23, 2005 7:32 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hi all

I have found a few problems using HT 3.1.0beta 1 - I suspect these should be classed as bugs - but I'm not sure where to post.

1 Memory - Attempts to reverse engineer large (100's) of tables consumes vast amounts of memory an eventually fails - I suspect either a memory leak or, holding data in memory before it is written to file to be the problem.

2 Generated .java code does not contain properties for all fields - so faw as I can the generated mapping.hbm files are correct but some generated .java code omits a few fields - the missing fields always end with "Id" e.g. partId, employeeID - these fields correspond to to fields in the form "TABLENAME_ID" in the database.

3 Generated documentation describes some fields as SQL type N/D - I can't see any reason for this - the fields are (I think) all of type varchar.

Eclipse 3.1.1
Hibernate Tools 3.1.0beta1
SQLServer
Jtds Driver


If anyone wants more info please let me know

db


Top
 Profile  
 
 Post subject: Re: Reverse Engineering Hibernate Tools 3.1.0beta1
PostPosted: Wed Nov 23, 2005 10:29 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
bolsover wrote:
1 Memory - Attempts to reverse engineer large (100's) of tables consumes vast amounts of memory an eventually fails - I suspect either a memory leak or, holding data in memory before it is written to file to be the problem.


Yep, thats bugging us too.
But apart from some minor glitches,
the tools saved lots of work for us!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 11:08 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Yes - I agree - potentially many hours of work saved - but for the missing properties

db


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 8:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the memory issue seem to keep occuring everywhere else than on the unittests ,) with hsqldb i can reverse engineer 4000 tables without any issues - using oracle behaves very different ,(

anyone that can help me track down how you make it happen please let me know ,)

the missing properties issue i would like some more explanation for ... a testcase maybe ?

;max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 9:07 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
We needed about 800 MBytes for reverse engineering
about 300 tables using db2 7.
I will post a memory count from some profiler,
when I have time.
Since reverse engineering isnt done often this is realy
not a big problem.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 10:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
800 mbytes is INSANE...should not be required and since i want to be able to run reveng again and again from inside the IDE it should not use that amount!

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:16 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
max wrote:

the missing properties issue i would like some more explanation for ... a testcase maybe ?

;max


SQLServer Table create:
***********************


CREATE TABLE [dbo].[TARE] (
[ROWID] [int] IDENTITY (1, 1) NOT NULL ,
[ID] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[BOL_ID] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
************************

Genrated mapping Tare.hbm.xml

***************************

<?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>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.nomogen.hibernate.ssve638.Tare" table="TARE" schema="dbo" catalog="ssve638">
<id name="id" type="string">
<column name="ID" length="30" />
<generator class="assigned" />
</id>
<property name="rowid" type="integer">
<column name="ROWID" not-null="true" />
</property>
<property name="bolId" type="string">
<column name="BOL_ID" length="20" />
</property>
<set name="shipperLinks" inverse="true">
<key>
<column name="TARE_ID" length="30" />
</key>
<one-to-many class="com.nomogen.hibernate.ssve638.ShipperLink" />
</set>
</class>
</hibernate-mapping>

***************************************

Genrated Tare.java

****************************************

package com.nomogen.hibernate.ssve638;

import java.util.Set;


/**
* Tare generated by hbm2java
*/

public class Tare implements java.io.Serializable {


// Fields

private String id;
private Bol bol;
private Integer rowid;
private Set shipperLinks;
private Set pallets;


// Constructors

/** default constructor */
public Tare() {
}

/** constructor with id */
public Tare(String id) {
this.id = id;
}




// Property accessors

public String getId() {
return this.id;
}

public void setId(String id) {
this.id = id;
}

public Bol getBol() {
return this.bol;
}

public void setBol(Bol bol) {
this.bol = bol;
}

public Integer getRowid() {
return this.rowid;
}

public void setRowid(Integer rowid) {
this.rowid = rowid;
}

public Set getShipperLinks() {
return this.shipperLinks;
}

public void setShipperLinks(Set shipperLinks) {
this.shipperLinks = shipperLinks;
}

public Set getPallets() {
return this.pallets;
}

public void setPallets(Set pallets) {
this.pallets = pallets;
}


}

*************************************

As you can see property bolId (column BOL_ID) has no corresponding getter/setter in the generated .java.

I should say that I have not (yet) tried to reproduce the problem using a database containing just one table.... My db has just under 700 tables.

...

Reverse engineering with all options checked failed when the java heap hit about 350Mb - I have yet to try with a larger initial heap.

db


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:27 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
bolsover wrote:
max wrote:

As you can see property bolId (column BOL_ID) has no corresponding getter/setter in the generated .java.

I should say that I have not (yet) tried to reproduce the problem using a database containing just one table.... My db has just under 700 tables.

db


Just tried on otherwise empty database - similar result - but with references to linked tables missing also.

db


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 8:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are only missing *one* each time, right ?

We had a nasty bug that kicks in that would let the code skip a property. Fixed in cvs....could you test again that ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 7:03 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hi Max

Sorry for the delay... had the weekend off.

I'll checkout code from cvs and try - might take a few days before I can get it done though.

Another thing - I noticed that SQLServer tinying get mapped to a short in the .java - shouln't this be a Short?

db


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 7:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why shold it be a java.lang.Short ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 10:54 am 
Beginner
Beginner

Joined: Mon Jun 06, 2005 4:23 am
Posts: 41
Location: Hagenberg, AUSTRIA
maybe this will help you:
http://forum.hibernate.org/viewtopic.php?t=950097&highlight=

i had similar problems when reverse engineering a large amount of database tables.

best regards
patrik


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 4:14 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
max wrote:
why shold it be a java.lang.Short ?


I understood that it was good practice to enclose java primitives in the corresponding wrapper class. This appears to have been done for other classes - such as Integer and BigDecimal - it seems odd that tinyint is mapped to a short.

I can think of one good practical reason for using a Short - what happens if the database contains a null? - This cannot be represented in a short property - but can in a Short.

db


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 4:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
as far as i know all numbers are mapped to their primitive counterpart.
We could (i guess) let the nullability of the column play a part in this decision - it isn't at the moment.

in any case you can redefine it via a cfg.xml.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 6:25 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
max wrote:

as far as i know all numbers are mapped to their primitive counterpart.
We could (i guess) let the nullability of the column play a part in this decision - it isn't at the moment.



That would certainly be good for me (and others?) - the present behaviour will cause exceptions to be thrown if you try to retrieve data from columns containing null values.

max wrote:
in any case you can redefine it via a cfg.xml.


I must be missing that in the docs... how?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next

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.