-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem:hbm2java task with DTD 3.0
PostPosted: Fri Oct 14, 2005 3:39 am 
Newbie

Joined: Mon Sep 26, 2005 8:43 am
Posts: 16
Hi,

I am into the process of upgrading Hibernate from version 2.1.6 to 3.0.5. Due to certain problems in new Hibernate tools (hibernate-tools-3.1.0.alpha5) I decided to continue making use of old tools to convert all the *.hbm.xml files to Java source files.
I changed the DTD from 2.0 to 3.0 across all *.hbm.xml files as the Hibernate 3 Migration guide says following regarding DTD change:

Quote:
DTD
Update the DTD reference in your hbm XML files. Change http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd
to http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in the DOCTYPE.
If your application took 5 seconds to startup and now takes 50 with Hibernate3,
you forgot to change the DTD. Hibernate will then try to lookup (and timeout) the
DTD on the Internet for every mapping file instead of its JAR file.


But change in DTD from version 2.0 to 3.0 causes following side effects:
1. Slow conversion from *.hbm.xml to java files (As it tries to look for the 3.0 DTD in hibernate2.jar and doesn't find it there so goes over internet)
2. Following kind of id member is being generated as long primitive type rather than java.lang.Long class type.(Which is generating java.lang.Long data type if the DTD is 2.0)

Code:
      <id name="guid" type="long">
         <meta attribute="scope-set">protected</meta>
         <column name="guid"/>
         <generator class="com.quinstreet.persistence.GuidGenerator"/>
      </id>

To overcome the problem 1 , I just added the 3.0 DTD to hibernate2.jar and it gave the fast performance :).
To overcome the problem 2, I need to either change the type to java.lang.Long or add a <meta ..> tag (Specifying the property-type atttribute as java.lang.Long).
Now problem 2 really surprises me. If I keep 2.0 DTD across all *.hbm.xml files then it generates the datatype as java.lang.Long and not the primitive type long for the above mentioned code. The thing that I don't understand is how come change of DTD from 2.0 to 3.0 affect the conversion process when I am continuing the use of old hibernate tools?

_________________
--Beejal


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 15, 2005 9:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dont know and i dont really care since the latest tool will do the sensible thing (use the primitive type name if you specified that otherwise the object version)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.