148 words

Issue #173 - Update query bug

BugVersion: 2.4.4Priority: NormalStatus: FixedReplies: 1
#1
2012-10-26 18:23

Some code. Problem in UPDATE query.

TypedQuery<List<Transport>> query = (TypedQuery<List<Transport>>) em.createQuery("SELECT t FROM Person p JOIN p.transports t WHERE p.personalCode = :code");
 
   query.setParameter("code", personalCode);
   List<List<Transport>> list = query.getResultList();
   List<Transport> temp = NEW Vector<Transport>();
   temp.ADD((Transport) attributeValue);
   list.ADD(temp);
   TypedQuery<Person> query2 = (TypedQuery<Person>) em.createQuery("UPDATE Person p SET p.transports = :list WHERE p.personalCode = :code", Person.class);
   query2.setParameter("list", list);
   query2.setParameter("code", personalCode);
   query2.executeUpdate();

----------------------------------------

Exception in thread "main" [ObjectDB 2.4.3] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) Client VM 1.7.0_07 (on Windows 7 6.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.NullPointerException: null
java.lang.NullPointerException
at com.objectdb.o.UPR$e._b(UPR.java:178)
at com.objectdb.o.UPR.b(UPR.java:82)
at com.objectdb.o.PRG.aj(PRG.java:872)
at com.objectdb.o.PRG.ag(PRG.java:651)
at com.objectdb.o.PRG.af(PRG.java:553)
at com.objectdb.o.QRM.U5(QRM.java:262)
at com.objectdb.o.MST.U5(MST.java:959)
at com.objectdb.o.WRA.U5(WRA.java:290)
at com.objectdb.o.WSM.U5(WSM.java:113)
at com.objectdb.o.QRR.g(QRR.java:239)
at com.objectdb.o.QRR.b(QRR.java:151)
at com.objectdb.jpa.JpaQuery.executeUpdate(JpaQuery.java:743)
at services.PersonService.updatePerson(PersonService.java:90)
at ui.CmdUI.updatePerson(CmdUI.java:262)
at ui.CmdUI.start(CmdUI.java:79)
at main.Main.main(Main.java:22)

 

Martynas
Martynas's picture
Joined on 2012-10-26
User Post #1
#2
2012-10-29 15:16

This UPDATE query is invalid because JPQL UPDATE queries are limited to setting values not collections.

Following your report the exception in this case was fixed with a meaningful error message.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,311

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel