-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate questions by the the depressed
PostPosted: Mon Jun 06, 2005 3:29 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

I've been using Hibernate for quite a time. And while doing my company's project, some questions arise :

1. Is Hibernate/HQL a good choice for report querying ? We're using Jasper Report and the data queried could be large. Our concern is primarily about memory usage of Hibernate query result and the complexity of the query(whether it's supported by HQL or not)

2. Is Hibernate/HQL suitable for mass data processing ? For example, mass update/delete/insert with explicit subselect in plain SQL. Here's an example :

UPDATE MstEmployee A
SET (A.employeeName, A.startDate, A.resignDate) =
( SELECT B.employeeName, B.startDate, B.resignDate
FROM TrfEmployee B
WHERE B.employeeCode = A.employeeCode
)
WHERE
Exists ( SELECT B.employeeCode
FROM TrfEmployee B
WHERE B.employeeCode = A.employeeCode
)

I've found the way in HQL for the 'Exists' clause, but the subselect in the UPDATE is still not supported. This is the quote from Hibernate Documentation : #
No joins (either implicit or explicit) can be specified in a bulk HQL query. Sub-queries may be used in the where-clause.
#
Is there any way around ?

This statement is still unresolved :

INSERT INTO MstEmployee
(employeeCode, employeeName, startDate, resignDate)
SELECT A.employeeCode, A.employeeName, A.startDate, A.resignDate
FROM TrfEmployee A
WHERE
Not Exists (
SELECT B.employeeCode
FROM MstEmployee B
WHERE B.employeeCode = A.employeeCode
)

As far as i've known, in Hibernate 3, there's been an additional feature of bulk update/delete, but none for insert.

How do we cope with this, should we try native sql for the complex statements or using many models or something else ?
We've been hoping that HQL could really give us an upper hand, so that if we switch database, we just change the dialect and all the HQLs used wont be changed. So the current policy, everything must be HQL-ed. But so far, there've been problems for complex statements, like those above.

Please advice T-T

Albert Kam

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 4:46 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Whats wrong with SQL/JDBC?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 5:48 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Quote:
We've been hoping that HQL could really give us an upper hand, so that if we switch database, we just change the dialect and all the HQLs used wont be changed. So the current policy, everything must be HQL-ed. But so far, there've been problems for complex statements, like those above.


It's our company's policy, =(
And our company's policy has just changed .. Use JDBC SQL for reports and complex processes, and Hibernate for the rest.
Use the right tool for the right job - Hibernate in Action

Sorry for the lamentation

Thanks :D

[/quote]

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 5:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This is not black and white. You can use SQL, but get the table and columnnames from Hibernate.


Top
 Profile  
 
 Post subject: Re: Hibernate questions by the the depressed
PostPosted: Tue Aug 30, 2005 1:18 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
albert_kam wrote:
Is there any way around ?


Here is one for Hibernate 3.0.5:

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


Top
 Profile  
 
 Post subject: Re: Hibernate questions by the the depressed
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  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 5:21 am 
Beginner
Beginner

Joined: Wed Feb 16, 2005 1:22 am
Posts: 25
Location: Jakarta
Thanks a lot for the hack and help. ^-^

_________________
Greater in battle
than the man who would conquer
a thousand-thousand men,
is he who would conquer
just one —
himself.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 5:31 am 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
It's probably the smell of a wet dog: http://www.journalhome.com/codecraft/8401/ :)


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