Sorry for the long post. Here's a much simpler example code-wise that still generates the second phantom NotifyEvent object insert statement with all null values as seen in the Cayenne log output. What could trigger a new NotifyEvent object be created?  There is a requirement for any NotifyQueue object to have a NotifyEvent but that is why I'm creating the NotifyEvent first

                NotifyEvent notifyEvent;
                ObjectContext oc = ClientBaseAdmin.getObjectContext();
                notifyEvent = oc.newObject(NotifyEvent.class);
                notifyEvent.setDTStart(start);

                oc.commitChanges();

                        NotifyQueue item = oc.newObject(NotifyQueue.class);
item.setClient(User.getLoggedInUser().getClient());
                        item.setNotifyEvent(notifyEvent);
System.out.println("***NotifyEvent-"+ notifyEvent.getDTStart());
System.out.println("***NotifyEvent2-"+ item.getNotifyEvent().getDTStart());
item.setNotifyContact(listContacts.get(0));

                            oc.commitChanges();

with the resultant Cayenne log output...

2019-02-12,09:33:26:586,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,INSERT INTO NotifyEvent (DTCompleted, DTStart, DTStopBy, clientID, createdDT, creatorContactID, defaultLanguage, description, durationMS, isTemplate, lockedToMinUserLevel, notes, notifyAppID, notifyAttachments, notifyBody, notifyContactID, notifyGroupID, notifyMessageID, notifyRepeatCount, notifyRepeatCronValue, notifyRepeatInterval, notifyRepeatMaxTimes, notifySubject, params, priority, recipientCountNotified, scheduleID, scriptName, statusID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2019-02-12,09:33:26:587,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,[bind: 1->DTCompleted:NULL, 2->DTStart:2019-02-12T10:00:18.566572, 3->DTStopBy:NULL, 4->clientID:201, 5->createdDT:2019-02-12T09:33:26.568155, 6->creatorContactID:200, 7->defaultLanguage:'EN', 8->description:'Callista Support created 2019-...', 9->durationMS:0, 10->isTemplate:'false', 11->lockedToMinUserLevel:0, 12->notes:'', 13->notifyAppID:2, 14->notifyAttachments:'', 15->notifyBody:'', 16->notifyContactID:NULL, 17->notifyGroupID:221, 18->notifyMessageID:1, 19->notifyRepeatCount:0, 20->notifyRepeatCronValue:';* * * * *  /scripts/script.sh', 21->notifyRepeatInterval:0, 22->notifyRepeatMaxTimes:0, 23->notifySubject:'', 24->params:'', 25->priority:0, 26->recipientCountNotified:0, 27->scheduleID:NULL, 28->scriptName:'', 29->statusID:1] 2019-02-12,09:33:26:589,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,Generated PK: NotifyEvent.id = 35 2019-02-12,09:33:26:589,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-12,09:33:26:589,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,UPDATE Client SET lastUpdateDT = ? WHERE id = ? 2019-02-12,09:33:26:589,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,[batch bind: 1->lastUpdateDT:2019-02-12T09:33:26.569944, 2->id:201] 2019-02-12,09:33:26:590,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-12,09:33:26:590,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,UPDATE Contact SET lastUpdateDT = ? WHERE id = ? 2019-02-12,09:33:26:590,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,[batch bind: 1->lastUpdateDT:2019-02-12T09:33:26.571646, 2->id:200] 2019-02-12,09:33:26:590,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-12,09:33:26:591,DEBUG,[http-nio-8080-exec-278],org.apache.cayenne.access.DataRowStore,postSnapshotsChangeEvent: [SnapshotEvent] source: org.apache.cayenne.access.DataRowStore@4d6ac29a, modified 2 id(s), indirectly modified 5 id(s) 2019-02-12,09:33:26:595,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,+++ transaction committed. 2019-02-12,09:33:26:598,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,--- transaction started. 2019-02-12,09:33:26:598,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,INSERT INTO NotifyEvent (DTCompleted, DTStart, DTStopBy, clientID, createdDT, creatorContactID, defaultLanguage, description, durationMS, isTemplate, lockedToMinUserLevel, notes, notifyAppID, notifyAttachments, notifyBody, notifyContactID, notifyGroupID, notifyMessageID, notifyRepeatCount, notifyRepeatCronValue, notifyRepeatInterval, notifyRepeatMaxTimes, notifySubject, params, priority, recipientCountNotified, scheduleID, scriptName, statusID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2019-02-12,09:33:26:600,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,[bind: 1->DTCompleted:NULL, 2->DTStart:NULL, 3->DTStopBy:NULL, 4->clientID:NULL, 5->createdDT:NULL, 6->creatorContactID:NULL, 7->defaultLanguage:NULL, 8->description:NULL, 9->durationMS:NULL, 10->isTemplate:NULL, 11->lockedToMinUserLevel:NULL, 12->notes:NULL, 13->notifyAppID:NULL, 14->notifyAttachments:NULL, 15->notifyBody:NULL, 16->notifyContactID:NULL, 17->notifyGroupID:NULL, 18->notifyMessageID:NULL, 19->notifyRepeatCount:NULL, 20->notifyRepeatCronValue:NULL, 21->notifyRepeatInterval:NULL, 22->notifyRepeatMaxTimes:NULL, 23->notifySubject:NULL, 24->params:NULL, 25->priority:NULL, 26->recipientCountNotified:NULL, 27->scheduleID:NULL, 28->scriptName:NULL, 29->statusID:NULL] 2019-02-12,09:33:26:608,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,*** error. com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'DTStart' cannot be null     at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]     at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]     at java.lang.reflect.Constructor.newInstance(Constructor.java:488) ~[?:?]     at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2124) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5158) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2043) ~[mysql-connector-java-5.1.47.jar:5.1.47]     at org.apache.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(BatchAction.java:168) ~[cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:87) ~[cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:97) ~[cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:273) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:233) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:153) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:624) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomain.onSyncNoFilters(DataDomain.java:594) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(DataDomain.java:822) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.TransactionFilter.lambda$onSync$0(TransactionFilter.java:61) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.DefaultTransactionManager$BaseTransactionHandler.performInTransaction(DefaultTransactionManager.java:183) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.DefaultTransactionManager$BaseTransactionHandler.performInNewTransaction(DefaultTransactionManager.java:155) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.DefaultTransactionManager$NestedTransactionHandler.handle(DefaultTransactionManager.java:98) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.DefaultTransactionManager.performInTransaction(DefaultTransactionManager.java:65) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.DefaultTransactionManager.performInTransaction(DefaultTransactionManager.java:43) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.tx.TransactionFilter.onSync(TransactionFilter.java:61) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomain$DataDomainSyncFilterChain.onSync(DataDomain.java:821) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:581) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:742) [cayenne-server-4.1.M2.jar:4.1.M2]     at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:691) [cayenne-server-4.1.M2.jar:4.1.M2]     at com.callistacti.clientbase.Wizards.WizNotification.wizardStepControl(WizNotification.java:208) [Lib-ClientBaseV8-1.0.jar:?]     at com.callistacti.clientbase.Wizards.WizNotification.next(WizNotification.java:693) [Lib-ClientBaseV8-1.0.jar:?]     at com.callistacti.clientbase.Wizards.WizNotification.lambda$buildPanelActionBar$61446b05$3(WizNotification.java:673) [Lib-ClientBaseV8-1.0.jar:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:499) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1014) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.ui.Button.fireClick(Button.java:384) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.ui.Button$1.click(Button.java:57) [vaadin-server-8.6.4.jar:8.6.4]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
    at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.PushHandler.lambda$new$1(PushHandler.java:148) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:248) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.PushHandler.onMessage(PushHandler.java:534) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.PushAtmosphereHandler.onMessage(PushAtmosphereHandler.java:87) [vaadin-server-8.6.4.jar:8.6.4]     at com.vaadin.server.communication.PushAtmosphereHandler.onRequest(PushAtmosphereHandler.java:77) [vaadin-server-8.6.4.jar:8.6.4]     at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:225) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:114) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:67) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2297) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:594) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.websocket.DefaultWebSocketProcessor$3.run(DefaultWebSocketProcessor.java:345) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.util.VoidExecutorService.execute(VoidExecutorService.java:101) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:340) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:448) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:272) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.atmosphere.container.JSR356Endpoint$3.onMessage(JSR356Endpoint.java:269) [atmosphere-runtime-2.4.30.vaadin1.jar:2.4.30.vaadin1]     at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:394) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:119) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151) [tomcat-websocket.jar:8.5.37]     at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) [tomcat-websocket.jar:8.5.37]     at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) [tomcat-coyote.jar:8.5.37]     at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-coyote.jar:8.5.37]     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-coyote.jar:8.5.37]     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-coyote.jar:8.5.37]     at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.37]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.37]
    at java.lang.Thread.run(Thread.java:844) [?:?]
2019-02-12,09:33:26:611,INFO ,[http-nio-8080-exec-278],org.apache.cayenne.log.JdbcEventLogger,*** transaction rolledback.



On 2019-02-11 10:05 a.m., Andrew Willerding wrote:
Hi,

Sorry for this long post item but I'm struggling with strange issue I haven't encountered before with Cayenne and hopefully I'm providing enough detail to get some insight into what my issue is.

A new database object is somehow being created without my explicit creation and I don't understand how or why it is happening.  Below is the output from the cayenne log that will correspond to the code extractions underneath it.

The **first** insert of NotifyEvent is the one I'm intending to create and it works correctly.  There are a number of data updates/retrievals underneath it as I'm accessing some of the objects that will be associated with the dependent NotifyQueue objects I wish to connect to the NotifyEvent.  It's the ***second*** NotifyEvent insertion with all null values is the one I don't understand how or where it's being inadvertently created in my code.

2019-02-11,09:38:28:058,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,INSERT INTO NotifyEvent (DTCompleted, DTStart, DTStopBy, clientID, createdDT, creatorContactID, defaultLanguage, description, durationMS, isTemplate, lockedToMinUserLevel, notes, notifyAppID, notifyAttachments, notifyBody, notifyContactID, notifyGroupID, notifyMessageID, notifyRepeatCount, notifyRepeatCronValue, notifyRepeatInterval, notifyRepeatMaxTimes, notifySubject, params, priority, recipientCountNotified, scheduleID, scriptName, statusID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2019-02-11,09:38:28:060,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,[bind: 1->DTCompleted:NULL, 2->DTStart:2019-02-11T10:00:15.043278, 3->DTStopBy:NULL, 4->clientID:201, 5->createdDT:2019-02-11T09:38:11.230615, 6->creatorContactID:200, 7->defaultLanguage:'EN', 8->description:'Callista Support created 2019-...', 9->durationMS:0, 10->isTemplate:'false', 11->lockedToMinUserLevel:0, 12->notes:'', 13->notifyAppID:2, 14->notifyAttachments:'', 15->notifyBody:'', 16->notifyContactID:NULL, 17->notifyGroupID:221, 18->notifyMessageID:1, 19->notifyRepeatCount:0, 20->notifyRepeatCronValue:';* * * * *  /scripts/script.sh', 21->notifyRepeatInterval:0, 22->notifyRepeatMaxTimes:0, 23->notifySubject:'', 24->params:'', 25->priority:0, 26->recipientCountNotified:0, 27->scheduleID:NULL, 28->scriptName:'', 29->statusID:1] 2019-02-11,09:38:28:061,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,Generated PK: NotifyEvent.id = 18 2019-02-11,09:38:28:061,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-11,09:38:28:061,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,UPDATE Client SET lastUpdateDT = ? WHERE id = ? 2019-02-11,09:38:28:062,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,[batch bind: 1->lastUpdateDT:2019-02-11T09:38:28.044136, 2->id:201] 2019-02-11,09:38:28:062,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-11,09:38:28:062,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,UPDATE Contact SET lastUpdateDT = ? WHERE id = ? 2019-02-11,09:38:28:062,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,[batch bind: 1->lastUpdateDT:2019-02-11T09:38:28.045692, 2->id:200] 2019-02-11,09:38:28:063,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,=== updated 1 row. 2019-02-11,09:38:28:064,DEBUG,[http-nio-8080-exec-129],org.apache.cayenne.access.DataRowStore,postSnapshotsChangeEvent: [SnapshotEvent] source: org.apache.cayenne.access.DataRowStore@5b5cf1ec, modified 2 id(s), indirectly modified 5 id(s) 2019-02-11,09:38:28:068,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,+++ transaction committed. 2019-02-11,09:38:28:068,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,--- transaction started. 2019-02-11,09:38:28:069,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,SELECT t0.notifyDetail, t0.statusID, t0.contactID, t0.notifyTypeID, t0.id FROM ContactCommunication t0 WHERE t0.contactID = ? [bind: 1->contactID:240] 2019-02-11,09:38:28:070,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,=== returned 3 rows. - took 1 ms. 2019-02-11,09:38:28:070,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,+++ transaction committed. 2019-02-11,09:38:28:073,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,--- transaction started. 2019-02-11,09:38:28:074,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,INSERT INTO NotifyEvent (DTCompleted, DTStart, DTStopBy, clientID, createdDT, creatorContactID, defaultLanguage, description, durationMS, isTemplate, lockedToMinUserLevel, notes, notifyAppID, notifyAttachments, notifyBody, notifyContactID, notifyGroupID, notifyMessageID, notifyRepeatCount, notifyRepeatCronValue, notifyRepeatInterval, notifyRepeatMaxTimes, notifySubject, params, priority, recipientCountNotified, scheduleID, scriptName, statusID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2019-02-11,09:38:28:074,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,[bind: 1->DTCompleted:NULL, 2->DTStart:NULL, 3->DTStopBy:NULL, 4->clientID:NULL, 5->createdDT:NULL, 6->creatorContactID:NULL, 7->defaultLanguage:NULL, 8->description:NULL, 9->durationMS:NULL, 10->isTemplate:NULL, 11->lockedToMinUserLevel:NULL, 12->notes:NULL, 13->notifyAppID:NULL, 14->notifyAttachments:NULL, 15->notifyBody:NULL, 16->notifyContactID:NULL, 17->notifyGroupID:NULL, 18->notifyMessageID:NULL, 19->notifyRepeatCount:NULL, 20->notifyRepeatCronValue:NULL, 21->notifyRepeatInterval:NULL, 22->notifyRepeatMaxTimes:NULL, 23->notifySubject:NULL, 24->params:NULL, 25->priority:NULL, 26->recipientCountNotified:NULL, 27->scheduleID:NULL, 28->scriptName:NULL, 29->statusID:NULL] 2019-02-11,09:38:28:080,INFO ,[http-nio-8080-exec-129],org.apache.cayenne.log.JdbcEventLogger,*** error. com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'DTStart' cannot be null     at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]     at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]     at java.lang.reflect.Constructor.newInstance(Constructor.java:488) ~[?:?]


Here's the extract of code that I'm executing that generates the first successful notifyEvent object and is now trying to create a number of objects that are dependent on it when it executes the NotifyQueue.createNotifyQueueItemsForContact method.

                notifyEvent.setNotifyRepeatCronValue(";* * * * * /scripts/script.sh");

                notifyEvent.getObjectContext().commitChanges();

                listSelectedNotifyQueueItems.clear();
                if (listAllNotifyQueueItems.isEmpty()) {
                    for (Contact listContact : listContacts) {
listAllNotifyQueueItems.addAll(NotifyQueue.createNotifyQueueItemsForContact(notifyEvent, listContact, listNotifyTypes, 0));
                    }
                }

Here is the NotifyQueue.createNotifyQueueItemsForContact code extract with some of my debug output statements...  The oc.committChanges() triggers the exception that appears in the debug.

    public static List<NotifyQueue> createNotifyQueueItemsForContact(NotifyEvent notifyEvent, Contact contact, List<NotifyType> listToNotifyType, int priority) {
        HashMap<String, NotifyQueue> result = new HashMap<>();
        ObjectContext oc = notifyEvent.getObjectContext();
        if (oc.hasChanges()){
            System.out.println("OC HAS CHANGES!!!");
            for (Object modifiedObject : oc.modifiedObjects()) {
                System.out.println("Modified object->" + modifiedObject);
            }
        }

        for (NotifyType notifyType : listToNotifyType) {
            if (notifyType.isEmail()) {
                if (!contact.getEmail().isEmpty()
                        && !result.containsKey(contact.getEmail())) {
                    if (contact.isNotifyActive(contact.getEmail())) {
                        NotifyQueue item = oc.newObject(NotifyQueue.class);
                        item.setAttemptCount(0);
                        // item.setDTStart(notifyEvent.getDTStart());
item.setClient(User.getLoggedInUser().getClient());
                        item.setNotifyEvent(notifyEvent);
System.out.println("***NotifyEvent-"+ notifyEvent.getDTStart());
                        item.setNotifyType(notifyType);
                        item.setNotifyContact(contact);
item.setNotifyRecipient(contact.getEmail());
                        item.setPriority(priority);
item.setStatusID(EnumNotifyStatus.CREATING.toShort());
        if (oc.hasChanges()){
            System.out.println("OC HAS CHANGES!!!");
            for (Object modifiedObject : oc.modifiedObjects()) {
                System.out.println("Modified object->" + modifiedObject);
            }
        }
                        oc.commitChanges();
                        result.put(item.getNotifyRecipient(), item);
                    }
                }

And this is what appears in my Console from the System.out statements.  There isn't an object in the OC has changes that references the second NotifyEvent object creation with all it's null values so I don't understand where it's being created and the intended notifyEvent object has the non null value of DTStart.

***NotifyEvent-2019-02-11T10:00:15.043278
OC HAS CHANGES!!!
Modified object->Name
Modified object->CCT Inc.
Modified object->Email
Modified object->CCT Support created 2019-02-11 09:38:28(18)
2019-02-11,09:38:28:072,DEBUG,[http-nio-8080-exec-129],app,ORMCayenne getObjectContext() retrieved for current thread
Feb 11, 2019 9:38:28 AM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
org.apache.cayenne.CayenneRuntimeException: [v.4.1.M2 Jul 11 2018 14:31:15] Commit Exception

Any help would be greatly appreciated.

Thanks,

Andrew


Reply via email to