You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Matthew Broadhead <ma...@nbmlaw.co.uk> on 2017/09/07 16:56:46 UTC

native query

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();
}

Re: native query

Posted by Matthew Broadhead <ma...@nbmlaw.co.uk>.
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 <ma...@nbmlaw.co.uk>:
>>
>> 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();
>> }


Re: native query

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
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 <ma...@nbmlaw.co.uk>:
> 
> 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();
> }