-->
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: hibernate precompiled statement
PostPosted: Wed Aug 24, 2005 2:54 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:45 pm
Posts: 38
Hi,

I'm using <sql-query/> within hibernate mapping files to represent sql statements. I have below qns regarding <sql-query/> -

1) Does hibernate parse the sql and keep it in precompiled statement format?

2) Do I have to include key fields within the sql statement specified inside <sql-query/> element? If I dont, hibernate throws an exception of Column not found.

3) Why is it mandatory to use Instrument ANT task onto value objects while using <sql-query/>? Is there any workaround for that?

Could someone plz give me any pointers for this qns? Thanks in advance for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 4:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
#1 we always use prepared statements, but the sql-query is not directly cache by hibernate

#2 yes, otherwise how should hibernate be able to see what the id is of your object ? (you can in H3 use scalar queries which doesnt have this requirement, but then cant return user objects)

#3 Have no idea why you should need to run the instrument ant task, how did you get that idea ?

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 10:25 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:45 pm
Posts: 38
Max,

Thanks for your reply !!

#1 we always use prepared statements, but the sql-query is not directly cache by hibernate

----- Does that mean <query/> is more performance optimized than <sql-query/>?

#2 yes, otherwise how should hibernate be able to see what the id is of your object ? (you can in H3 use scalar queries which doesnt have this requirement, but then cant return user objects)

----- That sounds good. I dont have problem selecting id fields. Just wanted to confirm if thats the right direction.

#3 Have no idea why you should need to run the instrument ant task, how did you get that idea ?

----- This is for handling lazy properties. I read abt Instrument task at

http://www.hibernate.org/hib_docs/v3/re ... properties
http://jira.jboss.com/jira/browse/EJBTHREE-217


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 10:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
In some senses the <query> is better cached and optimized than <sql-query> but do a performance measure before you deem it slow ;)

Lazy properties has nothing to do with sql-query.

/max

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