Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » unexplained insert
unexplained insert [message #857115] Thu, 26 April 2012 08:55 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
I've got a piece of code that adds Article2Storage entities. In the finest logging mode Eclipselink correctly has one persist call in the log.

[EL Finest]: 2012-04-26 10:28:07.708--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--PERSIST operation called on: nl.reinders.bm.Article2Storage@12882ad&Oidnr=null.
....
[EL Finest]: 2012-04-26 10:28:07.723--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--assign sequence to the object (412.932 -> nl.reinders.bm.Article2Storage@12882ad&Oidnr=null)


Then upon commit out of the blue an insert on Batchtype is executed, which results in an exception on the primary key (since it naturally already exist):

[EL Finer]: 2012-04-26 10:28:07.723--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--begin unit of work commit
[EL Finest]: 2012-04-26 10:28:07.723--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query DoesExistQuery(referenceClass=Batchtype )
[EL Finest]: 2012-04-26 10:28:07.723--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query DoesExistQuery(referenceClass=Article )
[EL Finest]: 2012-04-26 10:28:07.723--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query UpdateObjectQuery(nl.reinders.bm.Article@b045f4&Articlenr=13954)
[EL Finest]: 2012-04-26 10:28:07.739--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query UpdateObjectQuery(nl.reinders.bm.Storage@1acc3ad&Storagenr=34383&Description=A1/110)
[EL Finest]: 2012-04-26 10:28:07.739--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query WriteObjectQuery(nl.reinders.bm.Batchtype@407072&Batchtypenr=36128&Description=A1/110)
[EL Fine]: 2012-04-26 10:28:07.739--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--INSERT INTO batchtype (batchtypenr, pricerulecode, lazylock, dwhmodified, sellable_via_webshop, dwhby, description) VALUES (?, ?, ?, ?, ?, ?, ?)
bind => [36128, a1/110, 1, 2005-03-09 04:00:02.0, 1, null, A1/110]
[EL Fine]: 2012-04-26 10:28:07.754--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--UPDATE storage SET batchtype = ?, lazylock = ? WHERE ((storagenr = ?) AND (lazylock = ?))
bind => [36128, 16, 34383, 15]
[EL Fine]: 2012-04-26 10:28:07.754--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--UPDATE reindershst:storage SET hstvaliduntil = ? WHERE ((hstvaliduntil IS NULL) AND (storagenr = ?))
bind => [2012-04-26 10:28:07.754, 34383]
[EL Fine]: 2012-04-26 10:28:07.754--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--INSERT INTO reindershst:storage (storagenr, dwhmodified, storage_ean, lazylock, dwhby, description, batchtype, hstvalidfrom) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
bind => [34383, 2010-02-03 10:53:46.0, null, 16, 53, A1/110, 36128, 2012-04-26 10:28:07.754]
[EL Finest]: 2012-04-26 10:28:07.77--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query UpdateObjectQuery(nl.reinders.bm.Article2Storage@136834e&Oidnr=406071)
[EL Fine]: 2012-04-26 10:28:07.77--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--UPDATE article2storage SET articlenr = ?, dwhmodified = ?, dwhby = ?, storagenr = ?, lazylock = ? WHERE ((oidnr = ?) AND (lazylock = ?))
bind => [null, 2012-04-26 10:28:07.676, 24, null, 2, 406071, 1]
[EL Fine]: 2012-04-26 10:28:07.77--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--UPDATE reindershst:article2storage SET hstvaliduntil = ? WHERE ((hstvaliduntil IS NULL) AND (oidnr = ?))
bind => [2012-04-26 10:28:07.77, 406071]
[EL Fine]: 2012-04-26 10:28:07.77--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--INSERT INTO reindershst:article2storage (oidnr, dwhmodified, lazylock, dwhby, storagenr, articlenr, hstvalidfrom) VALUES (?, ?, ?, ?, ?, ?, ?)
bind => [406071, 2012-04-26 10:28:07.676, 2, 24, null, null, 2012-04-26 10:28:07.77]
[EL Finest]: 2012-04-26 10:28:07.77--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query InsertObjectQuery(nl.reinders.bm.Article2Storage@12882ad&Oidnr=412932)
[EL Fine]: 2012-04-26 10:28:07.77--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--INSERT INTO article2storage (oidnr, dwhmodified, lazylock, dwhby, storagenr, articlenr) VALUES (?, ?, ?, ?, ?, ?)
bind => [412932, 2012-04-26 10:28:07.723, 1, 24, 34383, 13954]
[EL Fine]: 2012-04-26 10:28:07.786--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--INSERT INTO reindershst:article2storage (oidnr, dwhmodified, lazylock, dwhby, storagenr, articlenr, hstvalidfrom) VALUES (?, ?, ?, ?, ?, ?, ?)
bind => [412932, 2012-04-26 10:28:07.723, 1, 24, 34383, 13954, 2012-04-26 10:28:07.786]
[EL Finest]: 2012-04-26 10:28:07.786--UnitOfWork(21324714)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Execute query DeleteObjectQuery(nl.reinders.bm.Article2Storage@136834e&Oidnr=406071)
[EL Fine]: 2012-04-26 10:28:07.786--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--DELETE FROM article2storage WHERE ((oidnr = ?) AND (lazylock = ?))
bind => [406071, 2]
[EL Fine]: 2012-04-26 10:28:07.786--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--UPDATE reindershst:article2storage SET hstvaliduntil = ? WHERE ((hstvaliduntil IS NULL) AND (oidnr = ?))
bind => [2012-04-26 10:28:07.786, 406071]
[EL Finer]: 2012-04-26 10:28:07.801--ClientSession(19420852)--Connection(31030541)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--commit transaction
[EL Fine]: 2012-04-26 10:28:07.817--ClientSession(19420852)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--select first 1 1 from systables
[EL Warning]: 2012-04-26 10:28:07.817--ClientSession(19420852)--Thread(Thread[SwingWorker-pool-1-thread-1,5,main])--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Unique constraint (informix.pk_batchtype) violated.


I have no clue why that insert is executed. There are no Cascading persists defined, only some removes on certain activities.
Re: unexplained insert [message #857125 is a reply to message #857115] Thu, 26 April 2012 09:03 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
Small addendum: I'm using Eclipselink 2.3.3-M1

And this is the problem code in the Standassign class:

public void createStorage()
{
// check to see if there already is a storage
String lStorageId = getStandversion().getStand().getStandid() + "/" + getCode();
Storage lStorage = Storage.findByDescription(lStorageId);
if (lStorage == null)
{
// add storage location
lStorage = new Storage();
lStorage.setDescription(lStorageId);
EntityManagerFinder.find().persist(lStorage);
}
else
{
// empty the storage
lStorage.removeAllArticle2Storage();
}

// set batchtype
lStorage.setBatchtype( getBatchtype() );

// fill storage with article
Article2Storage lArticle2Storage = new Article2Storage(getArticle(), lStorage);
EntityManagerFinder.find().persist(lArticle2Storage);
}

The "setBatchtype" is causing the insert.
Re: unexplained insert -> upgrade [message #857135 is a reply to message #857125] Thu, 26 April 2012 09:14 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
Upgrading to 2.4.0-M17.2 removed the problem.
NullPointerException, method not executed in small test case [message #869305 is a reply to message #857135] Thu, 03 May 2012 07:51 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
On 2012-04-26 11:14, tbee wrote:
> Upgrading to 2.4.0-M17.2 removed the problem.

But introduced another problem. By now I'm on M18, but I keep getting this exception:

java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Internal problem encountered while compiling [select e_0 from Sellexpect e_0 where e_0.iSellexpectnr IN (select e_1.iSellexpectnr from Sellexpectline e_1 where e_1.iStandversionnr IN (select e_2.iStandversionnr from Standversion e_2 where e_2.iStandnr IN (select e_3.iStandnr from Stand e_3 where lower(e_3.iStandid) like :e_3_iStandid)))].
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1505)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at nl.knowledgeplaza.util.jpa.EntityManagerExtender.invoke(EntityManagerExtender.java:542)
at $Proxy4.createQuery(Unknown Source)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.getQuery(JpaEntitySearchBuilder.java:1350)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.access$2(JpaEntitySearchBuilder.java:1339)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$13.run(JpaEntitySearchBuilder.java:1832)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$14.actionPerformed(JpaEntitySearchBuilder.java:1927)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1045)
at java.awt.Dialog$3.run(Dialog.java:1097)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1095)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:841)
at java.awt.Dialog.setVisible(Dialog.java:985)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchDialog(JpaEntitySearchBuilder.java:1761)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchSingleDialog(JpaEntitySearchBuilder.java:1618)
at org.tbee.swing.jpa.JpaObjectNavigatorBar$15.actionPerformed(JpaObjectNavigatorBar.java:325)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
==== cause:
Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20120418-r11171): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Internal problem encountered while compiling [select e_0 from Sellexpect e_0 where e_0.iSellexpectnr IN (select e_1.iSellexpectnr from Sellexpectline e_1 where e_1.iStandversionnr IN (select e_2.iStandversionnr from Standversion e_2 where e_2.iStandnr IN (select e_3.iStandnr from Stand e_3 where lower(e_3.iStandid) like :e_3_iStandid)))].
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildUnexpectedException(HermesParser.java:209)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:274)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:165)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:112)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:98)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:82)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1503)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at nl.knowledgeplaza.util.jpa.EntityManagerExtender.invoke(EntityManagerExtender.java:542)
at $Proxy4.createQuery(Unknown Source)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.getQuery(JpaEntitySearchBuilder.java:1350)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.access$2(JpaEntitySearchBuilder.java:1339)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$13.run(JpaEntitySearchBuilder.java:1832)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$14.actionPerformed(JpaEntitySearchBuilder.java:1927)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1045)
at java.awt.Dialog$3.run(Dialog.java:1097)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1095)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:841)
at java.awt.Dialog.setVisible(Dialog.java:985)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchDialog(JpaEntitySearchBuilder.java:1761)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchSingleDialog(JpaEntitySearchBuilder.java:1618)
at org.tbee.swing.jpa.JpaObjectNavigatorBar$15.actionPerformed(JpaObjectNavigatorBar.java:325)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
==== cause:
java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$InExpressionBuilder.visit(ExpressionBuilderVisitor.java:2198)
at org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatement.accept(SimpleSelectStatement.java:38)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visitInExpression(ExpressionBuilderVisitor.java:2000)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1227)
at org.eclipse.persistence.jpa.jpql.parser.InExpression.accept(InExpression.java:115)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1988)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.buildExpression(ExpressionBuilderVisitor.java:273)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.buildExpression(JPQLQueryContext.java:313)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visit(AbstractReadAllQueryVisitor.java:232)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visitAbstractSelectStatement(AbstractReadAllQueryVisitor.java:285)
at org.eclipse.persistence.internal.jpa.jpql.ReportQueryVisitor.visitAbstractSelectStatement(ReportQueryVisitor.java:91)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visit(AbstractReadAllQueryVisitor.java:224)
at org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatement.accept(SimpleSelectStatement.java:38)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.buildSubquery(ExpressionBuilderVisitor.java:365)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$InExpressionBuilder.visit(ExpressionBuilderVisitor.java:2191)
at org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatement.accept(SimpleSelectStatement.java:38)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visitInExpression(ExpressionBuilderVisitor.java:2000)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1227)
at org.eclipse.persistence.jpa.jpql.parser.InExpression.accept(InExpression.java:115)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1988)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.buildExpression(ExpressionBuilderVisitor.java:273)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.buildExpression(JPQLQueryContext.java:313)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visit(AbstractReadAllQueryVisitor.java:232)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:59)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visitAbstractSelectStatement(AbstractReadAllQueryVisitor.java:285)
at org.eclipse.persistence.internal.jpa.jpql.AbstractReadAllQueryVisitor.visit(AbstractReadAllQueryVisitor.java:186)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:69)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:407)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:69)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:388)
at org.eclipse.persistence.jpa.jpql.parser.JPQLExpression.accept(JPQLExpression.java:136)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:260)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:165)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:112)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:98)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:82)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1503)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at nl.knowledgeplaza.util.jpa.EntityManagerExtender.invoke(EntityManagerExtender.java:542)
at $Proxy4.createQuery(Unknown Source)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.getQuery(JpaEntitySearchBuilder.java:1350)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.access$2(JpaEntitySearchBuilder.java:1339)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$13.run(JpaEntitySearchBuilder.java:1832)
at org.tbee.swing.jpa.JpaEntitySearchBuilder$14.actionPerformed(JpaEntitySearchBuilder.java:1927)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1045)
at java.awt.Dialog$3.run(Dialog.java:1097)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1095)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:841)
at java.awt.Dialog.setVisible(Dialog.java:985)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchDialog(JpaEntitySearchBuilder.java:1761)
at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchSingleDialog(JpaEntitySearchBuilder.java:1618)
at org.tbee.swing.jpa.JpaObjectNavigatorBar$15.actionPerformed(JpaObjectNavigatorBar.java:325)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

On "my side" of the fence, this is the line where the exception is generated:

Query lQuery = lEntityManager.createQuery(lJql);

I've placed a breakpoint in the visit method at ExpressionBuilderVisitor.java:2198, and indeed the second time it gets there, the instance field stateFieldPathExpression is null.
However, if I try to create a small test case, there is no problem.

String lJql = "select e_0 from Sellexpect e_0 where e_0.iSellexpectnr IN (select e_1.iSellexpectnr from Sellexpectline e_1 where e_1.iStandversionnr IN (select e_2.iStandversionnr from Standversion e_2 where e_2.iStandnr IN (select e_3.iStandnr from Stand e_3 where lower(e_3.iStandid) like :e_3_iStandid)))";
Query lQuery = lEntityManager.createQuery(lJql);
lQuery.setParameter("e_3_iStandid", "a1");
System.out.println( lQuery.getResultList() );

The srrange thing is, in the small test case, the visit method (ExpressionBuilderVisitor.java:2198) never is executed. The breakpoint is not triggered. How can this be?
Re: NullPointerException, method not executed in small test case [message #869338 is a reply to message #869305] Thu, 03 May 2012 08:52 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
I've binary searched when the query problem was introduced, and it has happened in the M17.1 build.

initial problem gone query runs ok
2.3.3-M1 no yes
2.4.0-M9 yes yes
2.4.0-M14 yes yes
2.4.0-M16 yes yes
2.4.0-M17.1 yes no
2.4.0-M17.2 yes no
2.4.0-M18 yes no

I've settled on M16 for now.
Re: NullPointerException, method not executed in small test case [message #869535 is a reply to message #869338] Thu, 03 May 2012 14:43 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please log a bug for the issue. Can you also try the latest 2.4 nightly build?


James : Wiki : Book : Blog : Twitter
Re: NullPointerException, method not executed in small test case [message #869599 is a reply to message #869535] Thu, 03 May 2012 17:06 Go to previous message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
On 2012-05-03 16:43, James Sutherland wrote:
> Please log a bug for the issue. Can you also try the latest 2.4 nightly build?
>

https://bugs.eclipse.org/bugs/show_bug.cgi?id=378393

The nightly build will have to wait until the next time I'm working at the project.

Tom
Previous Topic:Trying to use OPERATOR fails
Next Topic:How to trigger pre-update computation on parent?
Goto Forum:
  


Current Time: Fri Nov 28 10:11:22 GMT 2014

Powered by FUDForum. Page generated in 0.22452 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software