-->
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: question on hibernate.cfg.xml
PostPosted: Wed Mar 29, 2006 3:35 pm 
Beginner
Beginner

Joined: Mon Feb 27, 2006 11:16 am
Posts: 25
Hi:

I am currently using Hibernate 3.05,MyEclipse 4.1.1, JDTS driver, Sql2000.

I have the following xml in my hibernate.cfg.xml:

<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<mapping resource="net/rrd/mdts/model/domainobject/FmwkUser.hbm.xml"/>
<mapping resource="net/rrd/mdts/model/domainobject/FmwrkSecurityGroupUser.hbm.xml"/>

</session-factory>
</hibernate-configuration>

Is there a way to change the hibernate.cfg.xml file so it will know how to find all of the hbm.xml files. I don't want to listed them all in the hibernate.cfg.xml. It's too troublesome and takes too much time.

Is there an url that talks about the options one have.

Any hint would be usefull.

Thanks.


Yours,

Frustrate.


Top
 Profile  
 
 Post subject: programmatically
PostPosted: Wed Mar 29, 2006 4:09 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Programmatically:
configuration = new Configuration();
configuration.getProperty( "hibernate.connection.url"));

configuration.configure( );
for( r : list of hbm file names obtained somehow ){
configuration.addResource( r);
}
sessionFactory =configuration.buildSessionFactory();

Or at build time, ant will create list of hbm files and stick it into hibernate configuration on copy:
configuration template could look like this
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
@mapping-resources@
</session-factory>
</hibernate-configuration>

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: hibernate.cfg.xml
PostPosted: Wed Mar 29, 2006 4:47 pm 
Beginner
Beginner

Joined: Mon Feb 27, 2006 11:16 am
Posts: 25
Hi:

But to do this if I just want to make the change in the hibernate.cfg.xml and I am not using Ant.

Yours,

Frustrated


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 4:54 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Programmatic way does not require Ant.

And also you can use configuration.addClass( MyPersistentClass.class );
and in the case the corresponding hbm file should be in the same package and has name MyPersistentClass.hbm.xml

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.