-->
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.  [ 3 posts ] 
Author Message
 Post subject: AnnotationConfiguration seems to ignore hibernate.cfg.xml
PostPosted: Fri Mar 23, 2007 9:29 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2.2.GA

Hibernate Annotations version:
3.3.0.GA

Hi,

I'm currently trying to use Hibernate Core with Hibernate Annotations.

So, I change my session factory creation as below following the documentation in Hibernate Annotations. However, it seems that, the created session factory does not include other configuration that I have in hibernate.cfg.xml. So, I wonder how to include those configuration into this AnnotationConfiguration instance.

sessionFactory = new AnnotationConfiguration()
.addAnnotatedClass(test.Department.class).buildSessionFactory();

Other configuration in my hibernate.cfg.xml that I need to add to AnnotationConfiguration are:

<property name="connection.datasource">java:/comp/env/jdbc/cis</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.pool_size">1</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="show_sql">true</property>
<property name="max_fetch_depth">3</property>


Or please advise if there's a way to include the hibernate.cfg.xml file to the AnnotationConfiguration instance. Feel free to highlight if I misunderstand the setup somewhere.

Great thanks.

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 25, 2007 10:13 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi,

Some advice regarding my question is very much appreciated.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 3:58 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you forgot to call configure()

_________________
Emmanuel


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