-->
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: How to bind all annotated classes at compile time???
PostPosted: Sat Dec 29, 2007 9:58 am 
Newbie

Joined: Sat Dec 29, 2007 9:44 am
Posts: 2
I am new to hibernate. I am using resin, hibernate with annotation.

I found problem that my first query take too much time to get data from database. The reason I found is that when first time I hit the application first page the hibernate bind all the annotated classes, verify named query etc and then after these work it get the data from the database. After this first hit query the other queries did not take much time as first one. I want to reduce the first query time by binding all annotated classes at compile time.

How to bind all annotated classes at compile time???

Please help me in this problem.

Regards,
wajid


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 29, 2007 11:03 am 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
I don't think Hibernate (or JPA) support compile time binding. The binding is performed when you create the Session (or EntityManager) factory as at that time you provide the configuration details. If you haven't done so one of way speeding up the binding process is to tell Hibernate in which classes to look for entities. This way Hibernate doesn't have to scan all class files on your classpath looking for annotations.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 29, 2007 11:23 am 
Newbie

Joined: Sat Dec 29, 2007 9:44 am
Posts: 2
thanks for your reply.

the thing is that i did not understand why hibernate search for the all classes even if i told the mappings in hibernate.cfg.xml.

also please let me know how to tell Hibernate in which classes to look for entities??

regard
wajid


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 29, 2007 8:22 pm 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
Try setting the property

hibernate.archive.autodetection="class, hbm"

or if you use XML configuration

<property name="hibernate.archive.autodetection" value="class, hbm"/>


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.