-->
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.  [ 6 posts ] 
Author Message
 Post subject: Middlegen Mapping Exception
PostPosted: Thu Jan 12, 2006 10:00 am 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Hi!

Can anyone help me? I'm a newbie of Middlegen.

I have an error when I tried to launch <ant hbm2java>

<target name="hbm2java" description="Generate .java from .hbm files.">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"
/>

<hbm2java output="${build.gen-src.dir}">
<fileset dir="${build.gen-src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>

I used Middlegen Hibernate plugin, I added hibernate-extensions-2.1.3
so that Hbm2JavaTask can be recognized. Besides, I imported all
neccessary hibernate jar by the classpath (lib.class.path).
Tools version:
- hibernate-3.0.5
- Middlegen-Hibernate-r5

java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException
ava.lang.NoClassDefFoundError: net/sf/hibernate/MappingException
at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:93)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:149)
at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:93)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 10:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your mixing H2 HBM for Hibernate 3.x .
Get the H3 tools jar from the latest Tools download (yes you will have to get the JAR from the package which includes the eclipse plugins).

You could consider moving to Hibernate Tools pack as an alternative.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 5:27 pm 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Thanks for answer ^^

But the latest package Hibernate Tools is a beta version. I think that it isn't stable, not yet. But I'll test it.
If I move to Hibernate Tool pack as an alternative, do I keep the Middlegen tool?

Thanks.

Tim


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 6:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The package is beta yes but it is quite solid.
You could choose to still use Middlegen (Make sure you set the version attibute to '3.0') and use the H3 tools Ant tools. If you are using eclipse then try out the eclipse hibernate plugins in the package. It has many features which make development easier.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 1:19 pm 
Newbie

Joined: Thu Jan 12, 2006 9:41 am
Posts: 15
Location: France
Hi!

I tried out the eclipse hibernate plugins and that works very well! But it generates DAO code that don't enjoy me. For example:
-UserHome whereas UserDao
-some CRUD methods like attachDirty whereas saveOrUpdate.
So I would like to change the template but I don't know where it is and how to change.

Can anyone help me?

Tim


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 17, 2006 4:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The templates are velocity templates and should be easy to find. You can also substitute your own templates if you wish.


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