Fast Object Database for Java - with JPA/JDO support

Issue #943: Update query bug

Type: Bug reoprtVersion: 2.4.4Priority: NormalStatus: FixedReplies: 1

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


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
com.objectdb.o.InternalException: java.lang.NullPointerException: null
at com.objectdb.o.UPR$e._b(
at com.objectdb.o.UPR.b(
at com.objectdb.o.PRG.aj(
at com.objectdb.o.QRM.U5(
at com.objectdb.o.MST.U5(
at com.objectdb.o.WRA.U5(
at com.objectdb.o.WSM.U5(
at com.objectdb.o.QRR.g(
at com.objectdb.o.QRR.b(
at com.objectdb.jpa.JpaQuery.executeUpdate(
at services.PersonService.updatePerson(
at ui.CmdUI.updatePerson(
at ui.CmdUI.start(
at main.Main.main(



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)

Post Reply