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.  [ 11 posts ] 
Author Message
 Post subject: Table and column names in Criterias
PostPosted: Tue Sep 27, 2005 4:48 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
Hi all,


Until now I used Torque, and I found very usefull the generated constants for Table and Column-names.
Does Hibernate provide such a functionality? In my opinion that is a great help for developers, and is a good practive from
quality assurance point of view.

Best,

Sergiu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 5:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you could easily add it to the templates used in the hibernate tools for code generation.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 9:59 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
You are right, it should be implemented as a template.
My question was actualy if it is planned to be implemented directly in
hibernate?

I think it will be quite easy to generate for each table/class mapping an Interface that will consist in string constants representing the table and culumn names.

Sergiu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 10:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sure - and you are more than welcome to provide a patch.

Generating an interface is actually a good way to do this - then people can choose on their own if they want it *out* or *in* their POJO's

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 2:35 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
Ok, I will try to d oit in this days, but I have another problem. I was not able to generate the java source code, and I didn't find an internet location to donwload the hibernate-tools source code.

I was creating the following ant script following the instructions from:
http://www.hibernate.org/hib_docs/tools/ant/index.html

<target name="generate-classes">
<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="classpath"
/>
<hibernatetool destdir="tmp">
<path refid="lib.class.path"/>
<jdbcconfiguration propertyFile="hibernate.properties"/>
<hbm2java ejb3="false" />
<!-- hbm2java templatespath="src/testsupport/templates"/ --> </hibernatetool>
</target>

When I run the ant target the Exception listed below occurs.
I was looking in hibernate tools package (extracted from hibernate-tools-3.1.0.alpha5.zip) and I ddn't find any Project class in org.hibernate.tool.ant package. Do I have a wrong version of the hibernate tools? I can't find the Project class into the alpha4 version, too.

Best,

Sergiu


BUILD FAILED
java.lang.NoSuchMethodError: org.apache.tools.ant.Project.createClassLoader(Lorg
/apache/tools/ant/types/Path;)Lorg/apache/tools/ant/AntClassLoader;
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:113)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 0 seconds
java.lang.NoSuchMethodError: org.apache.tools.ant.Project.createClassLoader(Lorg
/apache/tools/ant/types/Path;)Lorg/apache/tools/ant/AntClassLoader;
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:113)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)
org.apache.tools.ant.Project.createClassLoader(Lorg/apache/tools/ant/types/Path;
)Lorg/apache/tools/ant/AntClassLoader;

I got the following exception when running the java


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 3:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
looks to me like old version of ant.

source code for tools are in cvs see http://www.hibernate.org/268.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 3:44 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
Sory for the previous post, it was my mistake.

It seems that I need to use ant 1.6.5 for running the tasks.

Best,

Sergiu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 5:50 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
Finally I was able to run the hbm2java task successfully, after a few trials.

the final configuration I used is:
ant-1.6.2
hibernate3.jar and hibernate-tools.jar bith taken from
hibernate-tools-3.1.0.alpha5.zip

When I used the last available version of hibernate (3.1 beta 3)
I got the following exception.

BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass

Looking into the hibernate package I found that the SecondPass class is not a inner class of HbmBinder anymore. Therefore I found the solution to take
the hibernate and hibernate-tools jars from the hibernate tools realeases.


From those experience one question arises: Wouldn't be better to put the correct hibernate-tool jar into the hibernate releases? (right now it seems to be the other way, the correct version of hibernate can be found in hibernate-tools).

In my opinion hibernate-tools shouldn't be a separate project/jar.

Is is planed to merge the source code of tools into the main hibernate project?

Best,

Sergiu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 6:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes there are plans.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 5:12 am 
Newbie

Joined: Mon Sep 26, 2005 10:53 am
Posts: 10
max wrote:
sure - and you are more than welcome to provide a patch.

Generating an interface is actually a good way to do this - then people can choose on their own if they want it *out* or *in* their POJO's


I just implemented this functionality and I created the patch.
How can I submit the patch?

Best,

Sergiu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 7:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put it in our jira http://opensource2.atlassian.com/projec ... board.jspa thanks

_________________
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.  [ 11 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.