-->
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.  [ 12 posts ] 
Author Message
 Post subject: How to use Middlegen to generate Hibernate3.0 DTD mapping
PostPosted: Mon Nov 13, 2006 11:29 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Dear All
I need to use middlegen to generate HibernateMapping with Hibernate3.0 DTD.

I read documents from hibernate website

http://www.hibernate.org/98.html

It said as below

The Hibernate plugin generates the XML mapping document for Hibernate 2 only (This can be easily changed with additional templates). The motivation for this that a single output stream is easier to be maintained. Following is an example of the a mapping file generated by the plugin.

But I still dont know how to easily do this. Did any of you have idea?
could you throw some lights on it?

Thanks and Rgds


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 7:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen has supported Hibenate 3 mapping for quite some time. I commited the changes a very long time ago. Just include the Version tag in the Ant script to "3.0" and it will work fine. See online Middlegen documentation.
One thing, I do suggest you get the latest build from CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 8:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I have updated that wiki page to provide the information on setting the version property for Hibernate 3.0 mapping files.


Top
 Profile  
 
 Post subject: reply
PostPosted: Tue Nov 14, 2006 3:55 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
yeah I did the same but the syntax in this mapping file is still Hiberante2.0
My question is how to generate mapping file which use hibernate 3.0 syntax


Top
 Profile  
 
 Post subject: reply
PostPosted: Tue Nov 14, 2006 12:11 pm 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Hello

Thanks for your input

But I didnot find middlegen2.2 as you said
I only find midddlegen 2.1 from http://boss.bekk.no/boss/middlegen/

could you point me a link for middlegen2.2 download?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 7:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I never did get around to releasing it. Get it from CVS. Instructions are on the Middlegen web site.


Top
 Profile  
 
 Post subject: Reply
PostPosted: Wed Nov 15, 2006 4:18 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Hello I try to download from CVS from below link
http://sourceforge.net/cvs/?group_id=36044



But it always have problem as below error message shown


Could not connect to :pserver:anonymous@middlegen.cvs.sourceforge.net:/cvsroot/middlegen: I/O exception occurred: Connection refused: Fatal error, aborting. anoncvs_middlegen: no such system user


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 15, 2006 10:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Source forge did change the location of projects at some point - maybe docs are slightly incorrect. Check the project information and general information on source forge for correct location.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 16, 2006 5:57 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Hey David

I check out middlegen from CVS successfully today.
it works now.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 16, 2006 6:54 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Hello David

Thanks for your input

according to your suggestion. I go further with your Middlegen 2.2 tool.

But I still have 3 questions


1) do i need modify section of <taskdef name="hibernatedoclet"...
as below shown ? , orignal value is "2.0" , this modification is not
address in your WIKI website

<hibernate version="3.0"/>

2) when I try to generate hibernate mapping file agaisnt my Database
I always get below exception which leads me confused.

The relationshipRole's orign must be OFFER_GROUP_MEMBERS,but was
OFFER_GROUP_MEMBERS.

what does it mean?

3) When I looked mapping file which is genernated from middlegen2.2
Actually,it is not much different with mapping file generated from
middlegen 2.1 , only <meta> and DTD are changed. rest parts are almost same. it is correct?

Thanks and Rgds


Top
 Profile  
 
 Post subject: Reply
PostPosted: Thu Nov 16, 2006 9:55 am 
Beginner
Beginner

Joined: Mon Aug 22, 2005 9:57 pm
Posts: 27
Hello David

Moreover I found one problme with middlegen generated so called "hibernate3.0 supported" mapping.

the problem is althoug DTD is changed to hibernate 3.0 but
then content is still based on hibernate2.0 syntax.

Look below example

<one-to-one
name="offer"
class="com.x1.x2.hibernate.Offer"
outer-join="auto"
.......

for Hibernate 3.0
out-join is not used in one-to-one mapping.

How do i used middlegen 2.2 to generated mapping file which use
hibernate 3.0 syntax?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 16, 2006 6:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You may have found a bug in the velocity template. H2 is mostly a subset of H3 so in general it should all be fine. The template only need to check the version and remove the attribute. It is an easy fix. Once you have done it send me the patch and I will commit it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.