native query

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

native query

Matthew Broadhead
hi i tried this but it seems to just hang.  is this not supported?

private void updateAutoIncrement(int currentId) {
   Query q = em.createNativeQuery("ALTER TABLE test auto_increment = ?;");
   q.setParameter(1, (currentId + 2));
   q.executeUpdate();
}
Reply | Threaded
Open this post in threaded view
|

Re: native query

Mark Struberg-3
puh, cannot answer out of my head, but will write a unit test to dig.
Might help if you could provide a sample which also runs against EclipseLink and Hibernate.
After all this is also about interoperability.

LieGrue,
strub

> Am 07.09.2017 um 18:56 schrieb Matthew Broadhead <[hidden email]>:
>
> hi i tried this but it seems to just hang.  is this not supported?
>
> private void updateAutoIncrement(int currentId) {
>   Query q = em.createNativeQuery("ALTER TABLE test auto_increment = ?;");
>   q.setParameter(1, (currentId + 2));
>   q.executeUpdate();
> }

Reply | Threaded
Open this post in threaded view
|

Re: native query

Matthew Broadhead
i just moved to openjpa from eclipselink.  i didn't ever use hibernate.
so i am not sure what the sample code would look like.  i thought they
were all wrapped with the javax.persistence.* package now?

On 08/09/2017 10:09, Mark Struberg wrote:

> puh, cannot answer out of my head, but will write a unit test to dig.
> Might help if you could provide a sample which also runs against EclipseLink and Hibernate.
> After all this is also about interoperability.
>
> LieGrue,
> strub
>
>> Am 07.09.2017 um 18:56 schrieb Matthew Broadhead <[hidden email]>:
>>
>> hi i tried this but it seems to just hang.  is this not supported?
>>
>> private void updateAutoIncrement(int currentId) {
>>    Query q = em.createNativeQuery("ALTER TABLE test auto_increment = ?;");
>>    q.setParameter(1, (currentId + 2));
>>    q.executeUpdate();
>> }