Hello,
I have a CUIT entity, with a OneToMany List field called razonesSociales (that can be null):
@OneToMany (mappedBy = "cuit") private List razonesSociales;
When I run this query it works ok:
SELECT COUNT(item.sysID) FROM CUIT item WHERE ( (item.sysStatus.sysID=1) AND (item.razonesSociales.cuenta.vendedor.sysID=1000200) )
But in the Nosis entity, that have a CUIT field, when I run this query I get a com.objectdb.o.InternalException: java.lang.NullPointerException
SELECT COUNT(item.sysID) FROM Nosis item WHERE ( (item.sysStatus.sysID=1) AND (item.cuit.razonesSociales.cuenta.vendedor.sysID=1000200) )
The decompiler shows the exception in the marked line, because var3.ag() is null:
static PLN g(PLN var0, VAR var1, QUN var2) { if (var0 == null) { return null; } else { if (var2 instanceof JNN) { if (var2.D() && !((PLN)var0).s()) { return null; } JNN var3 = (JNN)var2; if (!var3.ag().e().isEntityOrObject()) { <<<< NullPointerException if (((PLN)var0).r(var3)) { return (PLN)var0; } return null; } } if (var1.e().isContainer()) { BIT var4 = var2.s(var1.H()); if (var4 != null && !((PLN)var0).f().e(var4)) { var0 = new EQP((PLN)var0, var1); } } Object var5 = new FIP((PLN)var0, var2); if (var2.D()) { var5 = new ANP((PLN)var5); } return (PLN)var5; } }
This is the stack trace:
com.objectdb.o.InternalException: java.lang.NullPointerException: null java.lang.NullPointerException at com.objectdb.o.WVP.g(WVP.java:584) at com.objectdb.o.WVP.a(WVP.java:245) at com.objectdb.o.WVP.a(WVP.java:218) at com.objectdb.o.WVP.d(WVP.java:183) at com.objectdb.o.WVP.e(WVP.java:133) at com.objectdb.o.WHP.c(WHP.java:352) at com.objectdb.o.WHP.e(WHP.java:255) at com.objectdb.o.WHP.b(WHP.java:187) at com.objectdb.o.WHP.b(WHP.java:181) at com.objectdb.o.WHP.b(WHP.java:181) at com.objectdb.o.WHP.b(WHP.java:123) at com.objectdb.o.QPN.g(QPN.java:88) at com.objectdb.o.QRC.j(QRC.java:213) at com.objectdb.o.QRM.ZX(QRM.java:273) at com.objectdb.o.MST.ZX(MST.java:1019) at com.objectdb.o.WRA.ZX(WRA.java:313) at com.objectdb.o.WSM.ZX(WSM.java:117) at com.objectdb.o.QRR.k(QRR.java:260) at com.objectdb.o.QRR.i(QRR.java:154) at com.objectdb.jpa.JpaQuery.getSingleResult(JpaQuery.java:755) ... at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834)
I guess that it's a bug.
Best Regards,
Pablo.