Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Stanimir Stamenkov Newsgroups: comp.lang.java.programmer Subject: Re: Spring/hibernate and JDBC Date: Sun, 10 Jul 2011 17:45:56 +0300 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <3c16e5e7-3c0b-4126-9dd9-88f372a58f03@e26g2000prf.googlegroups.com> <8niSp.53327$SG4.34636@newsfe03.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 10 Jul 2011 14:45:47 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="9eTmrOoDkUZt4jkjN/OnZw"; logging-data="16522"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sD6Mh+L3cODDbmbhSZuv2" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110706 Firefox/5.0 SeaMonkey/2.2 In-Reply-To: <8niSp.53327$SG4.34636@newsfe03.iad> X-Face: )>>ChyF_H On 11-07-10 09:34 AM, Tom Anderson wrote: > >> This has also been my impression. On my current project, we do still >> write raw SQL using JDBC on occasion, but only because we need to do >> some sort of mad query that can't be done with our persistence provider. >> For instance, we have a query that runs every hour to update our list of >> top-selling products, which joins together all sorts of tables and >> inserts the result directly into a table. I don't think there's any way >> to do that (up to and including inserting from the select) with JPA. > > Short of using features that are peculiar to an implementation, it seems > to me that if you had that result table described as a JPA entity, you > could use an EJBQL constructor expression to load up the to-be-inserted > entities from that mess of joins. Persist _those_. I was just about to ask whether one have used such Constructor Expressions in real life: http://download.oracle.com/javaee/5/tutorial/doc/bnbuf.html#bnbwc http://download.oracle.com/javaee/6/tutorial/doc/bnbuf.html#bnbwc -- Stanimir