-->
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.  [ 10 posts ] 
Author Message
 Post subject: Unable to build supporting files
PostPosted: Sat Dec 24, 2005 10:29 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1
Hibernate tools version: 3.0.1.beta2

Full stack trace of any exception that occurs:
Buildfile: C:\EclipseWorkSpace\FirstHibernateProject\build.xml
clean:
[delete] Deleting directory C:\EclipseWorkSpace\FirstHibernateProject\bin
[mkdir] Created dir: C:\EclipseWorkSpace\FirstHibernateProject\bin
codegen:
Overriding previous definition of reference to eclipse.ant.targetVector
hibernate-codegen:

BUILD FAILED
C:\EclipseWorkSpace\FirstHibernateProject\build.xml:64: The following error occurred while executing this line:
C:\EclipseWorkSpace\FirstHibernateProject\hibernate-codegen.xml:8: Could not create type hbm2java due to java.lang.NoSuchMethodException: org.hibernate.tool.ant.Hbm2JavaGeneratorTask.<init>(org.apache.tools.ant.Project)

Total time: 891 milliseconds


My build.xml portion :


<taskdef name="hbm2java" classname="org.hibernate.tool.ant.Hbm2JavaGeneratorTask"
classpathref="project.class.path"/>



<target name="codegen"
description="Generate java source-files from hbm.xml mapping files">
<ant antfile="hibernate-codegen.xml"
dir="."
inheritAll="true"
inheritRefs="true">
<reference refid="project.class.path"
torefid="project.class.path"/>
</ant>
</target>


sub-build.xml file:

<target name="hibernate-codegen"
description="Generate java source-files from hbm.xml mapping files" >
<hbm2java output="${targetdir}">
<fileset dir="${sourcedir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>





What I am trying to accomplish is generate the supporting files for a POJO that has a findAll method.

*.hbm.xml file:
<hibernate-mapping package="com.hibernate.test">
<class name="Honey" table="honey">

<meta attribute="session-method">
HibernateUtil.getSession();
</meta>
<id name="id" column="honeyId" type="java.lang.Integer">
<!-- postgre:
<generate class="sequence">
<param name="sequence">honey_id_seq</param>
</generate>
-->
<generator class="native"/>
</id>
<property name="name" column="honeyName" type="java.lang.String" />
<property name="taste" column="taste" type="java.lang.String" />
</class>
</hibernate-mapping>


I have attempted to follow the examples on how to go about this, but I have not been successful.

Any suggestions would be greatly appreciated.

Russ


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 4:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dont use the old hibernate 2 tools with hibernate 3 tools.

read tools.hibernate.org.

p.s. The finder generation has not been maintained - the closest thing is the DAO generation.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Hibernate 3.1 and Eclipse 3.2
PostPosted: Sun Dec 25, 2005 1:06 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
Max:

Thank you very much for responding. I re-read the tools.hibernate.org page. I don't think I have Hibernate and Hibernate Tools configured properly with Eclipse 3.2. I base this assumption on the fact I do not see the Code Generation Dialog box when I try to run the application.

Can you point in the right direction on how to ensure I have eclipse configured with the plugins correctly?

Russ


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 1:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
What do you mean: "I do not see the Code Generation Dialog box when I try to run the application" ?

If you press Ctrl+N there should be a Hibernate Console Configuration wizard that you should run to create a Console Configuration that points to your hibernate.cfg.xml *or* the mapping files you want to do something with.

When the console configuration you can run the Code generator via the small hibernate icon or under the Run/Hibernate Code Generation... menu

btw. eclipse 3.2 should work with the tools, but 3.1 is the supported one.

p.s. you don't need to use the eclipse plugins if you just want to use ant (again, read the documentation of our tools)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 3:09 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
Max:

Thank you for you reply. I've located the menu option under the "Run" pull down menu option. This seem to answer all my concerns, but one. The tool can not find the hbm.xml file. I have the file located under the src directory. Is it supposed to be somewhere else?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 3:24 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
Sorry, I should have included the reference in the config file:


<!-- Mapping files -->
<mapping resource="honey.hbm.xml"/>


The config and hbm files are in the same directory

Russ


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 4:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so it works now for you ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 4:38 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
Max:

Yes, I am able to use the tool, but I am NOT able to generate any files. The reason is the tool can not find the hbm.xml file.


org.hibernate.MappingException: Resource: com/hibernate/test/honey.hbm.xml not found
org.hibernate.MappingException: Resource: com/hibernate/test/honey.hbm.xml not found


I've put the honey.bhm.xl file in the same directory as i would expect the source code to be generated in--com.hibernate.test.

This is what I have in the hibernate.cfg.xml file.


<!-- Mapping files -->
<mapping resource="com/hibernate/test/honey.hbm.xml"/>


What am I doing wrong that prevents the tool from generating the files?

Russ


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 5:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to put the build path in the classpath of the console configuration

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 11:28 pm 
Beginner
Beginner

Joined: Thu Dec 08, 2005 12:18 pm
Posts: 21
Location: Birmingham, Alabama
okay I think the tool is working okay.......


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