-->
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.  [ 4 posts ] 
Author Message
 Post subject: Ant hibernatecfg task with inner class
PostPosted: Tue Jan 25, 2005 10:41 am 
Newbie

Joined: Tue Jan 25, 2005 10:28 am
Posts: 2
Hibernate version: 2.1.7

Hello,

i have a problem with the generated hibernate config and an inner class. i use this ant task to generate the hibernate.cfg.xml file:

<hibernatecfg
dialect="net.sf.hibernate.dialect.MySQLDialect"
driver="com.mysql.jdbc.Driver"
jdbcUrl="jdbc:mysql://localhost:3306/mydb"
userName="myself"
password="secret"
xmlencoding="ISO-8859-1"
hbm2ddl="create"
showSql="true"
/>

it generates this:

<hibernate-configuration>
<session-factory>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="use_outer_join">false</property>
<property name="connection.username">myself</property>
<property name="connection.password">secret</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/mydb</property>
<mapping resource="com/mine/AClass.hbm.xml" />
<mapping resource="com/mine/Attaboy.AttaboyManager.hbm.xml" />
</session-factory>
</hibernate-configuration>

The text marked in bold above refers to a inner class named Attaboy$AttaboyManager.class. It seems that in a later step, when coping all the hbm.xml files to the "bin" directory, the file Attaboy$AttaboyManager.hbm.xml is not loaded, since hibernate looks for Attaboy.AttaboyManager.hbm.xml. (For the other "normal" java classes, it works fine.)

I now either need a way to do this with ANT or a way to tweak the generation of the hibernatecfg....

Thanks any for ideas...

Raoul


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 11:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why dont you put it in "com/mine/AttaboyManager.hbm.xml" so your mapping files matches your .java files ?


we could probably add it, but its very minor ;)
add it to the jira if you want it (patches increases the possibility for getting it in)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 11:36 am 
Newbie

Joined: Tue Jan 25, 2005 10:28 am
Posts: 2
hello max,

thanks for your answer. The thing is, i would like to have everything fully automated, cause otherwise, people will eventually forget. right now i solved the problem by directly renaming the file through ant.

also i cannot put the info into AttaboyManager.hbm.xml, because that file is generated for me, by XDoclet.
So your suggetion seems to be, not to use inner classes at all, which would result in generation of AttaboyManager.hbm.xml AND Attaboy.hbm.xml, but it is nicer as inner class, codewise....

Best regards raoul


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 25, 2005 11:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put it in jira with those arguments ...

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