Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #16160
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JDBC, PreparedStatement and named parameters |
| Date | 2012-07-20 11:00 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <5dbaba81-9aab-4268-a3b0-030fb3686886@googlegroups.com> (permalink) |
| References | <slrnk0i9rb.u9l.avl@gamma.logic.tuwien.ac.at> <PtgOr.71$Mv7.19@newsfe12.iad> |
Daniel Pitts wrote: > Depending on your needs, a JPA provider (such as Hibernate) may be a A word to the wise: if you do use Hibernate itself, as opposed to, say, Apache OpenJPA or EclipseLink, make sure you use it as a JPA framework, and not as old-style Hibernate. > better approach. It moves you away from low-level SQL, and into more > object oriented notation. For certain values of "better". It is often better to use raw JDBC. You can more or less fake out named parameters with a combination of java.sql.PreparedStatement and an enum for the indexes. JPA has its own query language that directly supports named parameters. > It isn't always the best solution, and my experience with Hibernate has > been mixed. It's worth looking into and learning about it. They tend Hibernate is fine if you restrict yourself to the newer JPA approach. EclipseLink and OpenJPA know no other way. Keep your EntityManagers short-lived and don't share them across threads. Keep your EntityManagerFactory long-lived, and IIRC it's shareable. You have to use JPA in an idiomatically Java way to get its full value. > to be useful if you do exactly what they were designed for, and then > they get in your way when you need to do something different. The use case for raw JDBC is bulk operations. For object-to-relational mapping the JPA ORM frameworks are great. Don't get too fancy with your JPA. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-20 09:39 +0000
Re: JDBC, PreparedStatement and named parameters markspace <-@.> - 2012-07-20 06:31 -0700
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-20 14:52 +0000
Re: JDBC, PreparedStatement and named parameters markspace <-@.> - 2012-07-20 08:15 -0700
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-20 16:26 +0000
Re: JDBC, PreparedStatement and named parameters markspace <-@.> - 2012-07-20 09:37 -0700
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-20 21:04 +0000
Re: JDBC, PreparedStatement and named parameters markspace <-@.> - 2012-07-20 14:12 -0700
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-20 22:35 +0000
Re: JDBC, PreparedStatement and named parameters markspace <-@.> - 2012-07-20 16:08 -0700
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-21 14:32 +0000
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-24 16:18 +0000
Re: JDBC, PreparedStatement and named parameters Arne Vajhøj <arne@vajhoej.dk> - 2012-07-20 22:13 -0400
Re: JDBC, PreparedStatement and named parameters Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-07-20 10:22 -0700
Re: JDBC, PreparedStatement and named parameters Lew <lewbloch@gmail.com> - 2012-07-20 11:00 -0700
Re: JDBC, PreparedStatement and named parameters Arne Vajhøj <arne@vajhoej.dk> - 2012-07-20 22:11 -0400
Re: JDBC, PreparedStatement and named parameters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-07-21 14:47 +0000
Re: JDBC, PreparedStatement and named parameters jebblue <n@n.nnn> - 2012-07-23 22:14 -0500
Re: JDBC, PreparedStatement and named parameters jebblue <n@n.nnn> - 2012-07-23 22:19 -0500
Re: JDBC, PreparedStatement and named parameters Roedy Green <see_website@mindprod.com.invalid> - 2012-07-21 15:00 -0700
Re: JDBC, PreparedStatement and named parameters Arne Vajhøj <arne@vajhoej.dk> - 2012-07-21 21:53 -0400
csiph-web