-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate Observations and Questions
PostPosted: Tue Aug 16, 2005 9:35 am 
Beginner
Beginner

Joined: Sun Jul 31, 2005 1:23 pm
Posts: 35
I'm a new user to Hibernate 3.05 and ORM tools in general.

Hibernate/ORM seems great for the common scenarios where you need to INSERT/UPDATE individual db records or query record data.

However, it seems better to stick with straight SQL for
- Queries that aren't table related. SELECT COUNT(*) ...
- UPDATE statements on large data sets.
- Very DBMS specific tasks such as bulk load operations, backup/admin tasks, etc...

Is that the general consensus?

I like the way you can name hibernate queries and keep them in configuration files separate from the code. Is there a common technique to do the same with native SQL commands? I can just write my own simple XML config system, but is there a more standard solution?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 9:40 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Hibernate rocks for many many things but at times I feel it is better just to write some SQL and do it yourself, particularly for the things you outlined. As for a general consensus, I dunno. It's hard to get developers to agree that they all are carbon based, let alone agree on something like that.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 10:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use <sql-query> to get named native sql queries.

Your observation about DBMS specific tasks are correct.

UPDATE statements on large data sets is possible in H3, but
wether it is what you want or not depends on your needs.

Queries thar arent table related - I guess you here are talking about scalar/report queries ? Here I would disagree since that is one of the powers of Hibernate - it has very good support for it!

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Hibernate Observations and Questions
PostPosted: Tue Aug 30, 2005 1:00 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
Hibernate 3.0.5 supports bulk update and delete operations. However, it doesn't seem bulk insert is supported.

However, here is a work-around for bulk insert in Hibernate 3.0.5:

http://beanlib.sourceforge.net/Hibernat ... readme.txt
http://beanlib.sourceforge.net/Hibernat ... ert/3.0.5/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
any reason why you haven't submitted that stuff as an patch ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:13 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
max wrote:
any reason why you haven't submitted that stuff as an patch ?

Honestly that's because it's a hack, not a proper solution for the long term. The up side is the hack works! And it took me less than a day effort to make it happen. The down side is it introduces the use of a special "null" column alias notation (just to keep Hibernate happy) plus the side effect of native SQL query to make it work.

The proper solution is to support bulk insert operation directly in HQL. This involes changing the antlr grammer, etc., and will take longer to implement, and it's probably make more sense to leave it to someone who is more familiar with the existing Hibernate code base.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
many of the patches we receive are not 100% so a hack is better than nothing ;)

we do have insert in hql and we do want the bulk update/delete to also be allowed via sql-query.

as you have already used a day to tweak hibernate then I suggest you submit it and maybe we can use parts of it - that saves us time!
...but of course if it is too much of a hack we wont apply it - but thats life anyhow ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:57 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
ok, here you go the patch:

http://opensource2.atlassian.com/projec ... se/HHH-915


Top
 Profile  
 
 Post subject: Re: Hibernate Observations and Questions
PostPosted: Thu Sep 01, 2005 1:10 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
http://hansonchar.blogspot.com/2005/09/ ... e-305.html


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