-->
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: Is it possible to use insert with select subquery??
PostPosted: Tue Nov 18, 2003 4:55 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:32 pm
Posts: 28
To whom it may concern,

Is it possible to use the following sql synatx in Hibernate:

Insert table1(x, y) select table2.v1, table3.v2 from table2, table3 where table2.id = table3.id and table2.v4 = 1 and table3.v5=2

If yes, how can I use hibernate to generate a sql query like the above??

If not, what is the alternative in Hibernate that I can get almost the same performance as the above sql statement? I am dealing with more than 10 million rows insert. Thanks

Vivian Fonger


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 5:47 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate is not suitable for mass inserts, updates and deletes, thats what JDBC and SQL are best for.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Mass inserts
PostPosted: Tue Nov 18, 2003 6:50 pm 
Newbie

Joined: Wed Sep 03, 2003 11:30 pm
Posts: 5
Location: Minneapolis, Minnesota, USA
christian wrote:
Hibernate is not suitable for mass inserts, updates and deletes, thats what JDBC and SQL are best for.


Some databases have utilities specifically for this type of insert. In SYBASE, it is bulk copy (BCP). The insert you described, with over a million rows, would run significantly faster if your database has this type of utility. SYBASE's BCP would increase your performance by a factor of 10 or so.


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.