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


Groups > comp.lang.java.programmer > #32324 > unrolled thread

Is it possible to use JPA and JDBC at the same time

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-08-13 20:14 +0200
Last post2015-08-19 11:57 +0200
Articles 5 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Is it possible to use JPA and JDBC at the same time Cecil Westerhof <Cecil@decebal.nl> - 2015-08-13 20:14 +0200
    Re: Is it possible to use JPA and JDBC at the same time Arne Vajhøj <arne@vajhoej.dk> - 2015-08-13 20:21 -0400
      Re: Is it possible to use JPA and JDBC at the same time Cecil Westerhof <Cecil@decebal.nl> - 2015-08-17 08:24 +0200
        Re: Is it possible to use JPA and JDBC at the same time Arne Vajhøj <arne@vajhoej.dk> - 2015-08-17 19:43 -0400
          Re: Is it possible to use JPA and JDBC at the same time Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 11:57 +0200

#32324 — Is it possible to use JPA and JDBC at the same time

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-08-13 20:14 +0200
SubjectIs it possible to use JPA and JDBC at the same time
Message-ID<87vbcj3vja.fsf@Equus.decebal.nl>
I am new to JPA and have to migrate an application from JDBC to JPA.
There are quite some queries. Would it be possible to mix JDBC and JPA
together?

I would suppose not, but if it was possible, that would circumvent a
big bang.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#32327

FromArne Vajhøj <arne@vajhoej.dk>
Date2015-08-13 20:21 -0400
Message-ID<55cd346e$0$304$14726298@news.sunsite.dk>
In reply to#32324
On 8/13/2015 2:14 PM, Cecil Westerhof wrote:
> I am new to JPA and have to migrate an application from JDBC to JPA.
> There are quite some queries. Would it be possible to mix JDBC and JPA
> together?
>
> I would suppose not, but if it was possible, that would circumvent a
> big bang.

The standard problems with using two persistence frameworks are
cache inconsistencies and transactional issues.

I have not read the fine print in the JPA specs to say whether
this would be a problem for JPA and JDBC.

But I would probably go for big bang JPA. Lower risk. And
with createNativeQuery you can execute SQL queries (so you
can reuse you existent SQL queries).

Arne

[toc] | [prev] | [next] | [standalone]


#32333

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-08-17 08:24 +0200
Message-ID<87mvxqsa9n.fsf@Equus.decebal.nl>
In reply to#32327
On Friday 14 Aug 2015 02:21 CEST, Arne Vajhøj wrote:

> On 8/13/2015 2:14 PM, Cecil Westerhof wrote:
>> I am new to JPA and have to migrate an application from JDBC to
>> JPA. There are quite some queries. Would it be possible to mix JDBC
>> and JPA together?
>>
>> I would suppose not, but if it was possible, that would circumvent
>> a big bang.
>
> The standard problems with using two persistence frameworks are
> cache inconsistencies and transactional issues.
>
> I have not read the fine print in the JPA specs to say whether
> this would be a problem for JPA and JDBC.
>
> But I would probably go for big bang JPA. Lower risk. And
> with createNativeQuery you can execute SQL queries (so you
> can reuse you existent SQL queries).

I was afraid for that. ;-) There are a lot of queries. :-( But for
testing purposes I could maybe do it class by class.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#32344

FromArne Vajhøj <arne@vajhoej.dk>
Date2015-08-17 19:43 -0400
Message-ID<55d271ba$0$301$14726298@news.sunsite.dk>
In reply to#32333
On 8/17/2015 2:24 AM, Cecil Westerhof wrote:
> On Friday 14 Aug 2015 02:21 CEST, Arne Vajhøj wrote:
>> On 8/13/2015 2:14 PM, Cecil Westerhof wrote:
>>> I am new to JPA and have to migrate an application from JDBC to
>>> JPA. There are quite some queries. Would it be possible to mix JDBC
>>> and JPA together?
>>>
>>> I would suppose not, but if it was possible, that would circumvent
>>> a big bang.
>>
>> The standard problems with using two persistence frameworks are
>> cache inconsistencies and transactional issues.
>>
>> I have not read the fine print in the JPA specs to say whether
>> this would be a problem for JPA and JDBC.
>>
>> But I would probably go for big bang JPA. Lower risk. And
>> with createNativeQuery you can execute SQL queries (so you
>> can reuse you existent SQL queries).
>
> I was afraid for that. ;-) There are a lot of queries. :-( But for
> testing purposes I could maybe do it class by class.

Look at it from the positive - you can probably
replace 15 lines of code with JDBC with 1 line of code
using JPA in most places and by that help clean up the code.

Arne

[toc] | [prev] | [next] | [standalone]


#32357

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-08-19 11:57 +0200
Message-ID<87io8br46n.fsf@Equus.decebal.nl>
In reply to#32344
On Tuesday 18 Aug 2015 01:43 CEST, Arne Vajhøj wrote:

> On 8/17/2015 2:24 AM, Cecil Westerhof wrote:
>> On Friday 14 Aug 2015 02:21 CEST, Arne Vajhøj wrote:
>>> On 8/13/2015 2:14 PM, Cecil Westerhof wrote:
>>>> I am new to JPA and have to migrate an application from JDBC to
>>>> JPA. There are quite some queries. Would it be possible to mix
>>>> JDBC and JPA together?
>>>>
>>>> I would suppose not, but if it was possible, that would
>>>> circumvent a big bang.
>>>
>>> The standard problems with using two persistence frameworks are
>>> cache inconsistencies and transactional issues.
>>>
>>> I have not read the fine print in the JPA specs to say whether
>>> this would be a problem for JPA and JDBC.
>>>
>>> But I would probably go for big bang JPA. Lower risk. And
>>> with createNativeQuery you can execute SQL queries (so you
>>> can reuse you existent SQL queries).
>>
>> I was afraid for that. ;-) There are a lot of queries. :-( But for
>> testing purposes I could maybe do it class by class.
>
> Look at it from the positive - you can probably
> replace 15 lines of code with JDBC with 1 line of code
> using JPA in most places and by that help clean up the code.

Yes, that is one of the big benefits. Also that changes are only
needed in the class itself.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web