jpa - datanucleus + postgresql + jpql error in simple update clause -


i have tried fix 6 hours now, , couldn't life of me figure out.

i'm using :

  • datanucleus 3.2.1, jpa
  • postgresql 8.4.4 on x86_64-unknown-linux-gnu, compiled gcc gcc (gcc) 3.4.6 20060404 (red hat 3.4.6-10), 64-bit
  • postgres jdbc driver version : 9.1-901.jdbc4

i'm trying execute simple update query through jpql. query :

update myclass x set x.recordstatus='0' x.token='1234' 

my code looks :

    string updateclause = "update myclass x set x.recordstatus='0' x.token='1234'";     entitymanager entitymanager = getdefaultentitymanager();     query query = entitymanager.createquery(updateclause);     query.executeupdate();     entitymanager.close(); 

the problem have error thrown driver

caused by: org.postgresql.util.psqlexception: error: column "a0" of relation "my_class" not exist                                 position: 42                                     @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2102)                                     @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:1835) 

this somehwat normal, in terms postgres accepts updates in form :

update some_table x set field=value field2=another_value 

...but not

update some_table x set x.field=value x.field2=another_value 

(i.e. no aliases in set or clause when executing update)

i have tried writing jpql query :

  • without using aliases in set , clauses (update myclass x set recordstatus='0' token='1234'), logs show me datanucleus compiles query native query uses aliases anyway.

  • without using aliases @ (not class name), in case datanucleus throws me error must have alias.

for complete list of dependencies, please see end of post.

my questions :

  • how can overcome problem ? doing wrong ?
  • a basic use case of important feature, fails datanucleus. not first time things happen. example see post : datanucleus + jpa + oracle. strange error tables not existing have other examples. doesn't good, , don't understand why, because couldn't find other posts complaining type of problems. combination(datanucleus + postgres) unused ? looks abandoned.

thank time. kind regards, andrei

my list of dependencies :

    <dependency>         <groupid>org.apache.geronimo.specs</groupid>         <artifactid>geronimo-jpa_2.0_spec</artifactid>         <version>1.0</version>     </dependency>      <dependency>         <groupid>postgresql</groupid>         <artifactid>postgresql</artifactid>         <version>9.1-901.jdbc4</version>     </dependency>      <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-core</artifactid>         <version>3.2.1</version>     </dependency>     <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-rdbms</artifactid>         <version>3.2.0-release</version>     </dependency>     <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-api-jpa</artifactid>         <version>3.2.0-release</version>     </dependency>     <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-connectionpool</artifactid>         <version>2.0.3</version>     </dependency>     <dependency>         <groupid>javax.jdo</groupid>         <artifactid>jdo2-api</artifactid>         <version>2.2</version>     </dependency> 


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -