Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32144

Re: From JDBC to JPA

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!aioe.org!.POSTED!not-for-mail
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: From JDBC to JPA
Date Sat, 25 Jul 2015 23:49:00 -0400
Organization Aioe.org NNTP Server
Lines 35
Message-ID <mp1lbf$402$1@speranza.aioe.org> (permalink)
References <87380doatw.fsf@Equus.decebal.nl> <motqel$lmt$1@dont-email.me> <87y4i5mig2.fsf@Equus.decebal.nl> <slrnmr6h6k.7mm.fredrik@biggles.jonson.org>
NNTP-Posting-Host bLmKSxgyEsD8qtT7wjgUDQ.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
X-Notice Filtered by postfilter v. 0.8.2
X-Mozilla-News-Host news://nntp.aioe.org
Xref csiph.com comp.lang.java.programmer:32144

Show key headers only | View raw


On 7/25/2015 4:12 AM, Fredrik Jonson wrote:
> In <87y4i5mig2.fsf@Equus.decebal.nl> Cecil Westerhof wrote:
>
>>   I need to write clean JPA code, because it should be possible two switch
>>   from Hibernate to openJPA in a moments notice.
>
> That is a requirement that is not as easy to fulfill as is appears on first
> sight. Especially for someone who does not have experience with JPA already.
>
> I think you'll find that each JPA implementation has its own set of quirks in
> performance as well as in configuration. And since you're combining it with a
> database, you'll have your database provider's quirks to consider too.
>
> A more reasonable goal is to use only standard JPA annotations for the beans
> and most queries, and otherwise aim to limit the provider specific stuff to
> parts of the code that you design to be rather easily replaceable when you
> decide to try to migrate to another provider. That said, you can get quite far
> with plain JPA, at least as long as your database model isn't too complex.
>
> Not to say that JPA is special in this way. Almost every standard that have
> multiple implementations also have quirks that are specific to each
> implementation. The common case is obviously usually better covered and more
> similar between implementations.
>
> On a related theme: Do not be afraid to use native queries when building more
> complex queries. There's nothing wrong with JQL, but you do not have the same
> control over the details compared to plain SQL.

It is my impression that a lot of people (maybe the large majority of
people) are able to do with only standard JPA code - maybe with a small
dose of standard SQL where necessary.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

From JDBC to JPA Cecil Westerhof <Cecil@decebal.nl> - 2015-07-24 17:05 +0200
  Re: From JDBC to JPA Eternal Hope <laughingspam99@gmail.com> - 2015-07-24 17:53 +0100
    Re: From JDBC to JPA Cecil Westerhof <Cecil@decebal.nl> - 2015-07-24 22:03 +0200
      Re: From JDBC to JPA Eternal Hope <laughingspam99@gmail.com> - 2015-07-25 05:23 +0100
        Re: From JDBC to JPA Cecil Westerhof <Cecil@decebal.nl> - 2015-07-25 10:37 +0200
          Re: From JDBC to JPA Arne Vajhøj <arne@vajhoej.dk> - 2015-07-25 23:45 -0400
      Re: From JDBC to JPA Fredrik Jonson <fredrik@jonson.org> - 2015-07-25 08:12 +0000
        Re: From JDBC to JPA Arne Vajhøj <arne@vajhoej.dk> - 2015-07-25 23:49 -0400
      Re: From JDBC to JPA Arne Vajhøj <arne@vajhoej.dk> - 2015-07-25 23:38 -0400
  Re: From JDBC to JPA Joerg Meier <joergmmeier@arcor.de> - 2015-07-24 20:40 +0200
  Re: From JDBC to JPA Jeff Higgins <jeff@invalid.invalid> - 2015-07-24 15:45 -0400
    Re: From JDBC to JPA Cecil Westerhof <Cecil@decebal.nl> - 2015-07-24 22:32 +0200
  Re: From JDBC to JPA Joerg Meier <joergmmeier@arcor.de> - 2015-07-24 22:32 +0200
    Re: From JDBC to JPA Cecil Westerhof <Cecil@decebal.nl> - 2015-07-24 23:18 +0200
  Re: From JDBC to JPA Arne Vajhøj <arne@vajhoej.dk> - 2015-07-25 14:40 -0400
    Re: From JDBC to JPA Arne Vajhøj <arne@vajhoej.dk> - 2015-07-25 23:53 -0400
      Re: From JDBC to JPA Lew <lewbloch@gmail.com> - 2015-08-03 15:43 -0700

csiph-web