I am getting a very strange problem. My SQL crashes with "'TaskID' doesn't have a default value".
This is a fact. It is one of two fields that make up a table's primary key. TaskID and TeamMemberID. Notice in the Tomcat log below that both of these values are supplied on an _add operation. Yet, they are missing from the 'INSERT INTO PUBLIC.TaskSubscriber' column list and values.
Everything else around them works. And, I remember everything working in this area of code before I revisited it.
Here is the dataSource.
Here is the ds.xml for it.
And, here is the form holding the values.
Of course, it will be something I changed. But, I cannot find where.
Maybe a keen eye will see find where the values get lost.
I will start looking again after coffee in the AM.
Rick
P.S. I am running SmartClient Version: v8.3p_2014-06-27/EVAL on Mozilla Firefox 20.0 with Firebug using Windows 7 Premium 64 bit.
This is a fact. It is one of two fields that make up a table's primary key. TaskID and TeamMemberID. Notice in the Tomcat log below that both of these values are supplied on an _add operation. Yet, they are missing from the 'INSERT INTO PUBLIC.TaskSubscriber' column list and values.
Everything else around them works. And, I remember everything working in this area of code before I revisited it.
Code:
=== 2014-08-11 20:21:44,902 [sor2] DEBUG RPCManager - Request #1 (DSRequest) payload: { values:{ DueReminderDate:new Date(1407715200000), CommunityID:101, ProjectID:102, TaskID:106, StatusChangeOption:true, AnyChangeOption:false, DueReminderOption:false, DueReminderTime:new Date(28800000), TeamMemberID:104 }, operationConfig:{ dataSource:"TaskSubscriber", operationType:"add" }, componentId:"TaskSubscriberForm", appID:"builtinApplication", operation:"TaskSubscriber_add", oldValues:{ }, criteria:{ } } === 2014-08-11 20:21:44,918 [sor2] INFO IDACall - Performing 1 operation(s) === 2014-08-11 20:21:44,918 [sor2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2014-08-11 20:21:44,918 [sor2] DEBUG DeclarativeSecurity - DataSource TaskSubscriber is not in the pre-checked list, processing... === 2014-08-11 20:21:44,918 [sor2] DEBUG AppBase - [builtinApplication.TaskSubscriber_add] No userTypes defined, allowing anyone access to all operations for this application === 2014-08-11 20:21:44,933 [sor2] DEBUG AppBase - [builtinApplication.TaskSubscriber_add] No public zero-argument method named '_TaskSubscriber_add' found, performing generic datasource operation === 2014-08-11 20:21:44,933 [sor2] INFO SQLDataSource - [builtinApplication.TaskSubscriber_add] Performing add operation with criteria: {DueReminderDate:new Date(1407715200000),CommunityID:101,ProjectID:102,TaskID:106,StatusChangeOption:true,AnyChangeOption:false,DueReminderOption:false,DueReminderTime:new Date(28800000),TeamMemberID:104} values: {DueReminderDate:new Date(1407715200000),CommunityID:101,ProjectID:102,TaskID:106,StatusChangeOption:true,AnyChangeOption:false,DueReminderOption:false,DueReminderTime:new Date(28800000),TeamMemberID:104} === 2014-08-11 20:21:44,949 [sor2] DEBUG SQLValuesClause - [builtinApplication.TaskSubscriber_add] Sequences: {TeamMemberID=__default, TaskID=__default} === 2014-08-11 20:21:44,949 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.TaskSubscriber_add] Connection was already closed in validateObject - returning false === 2014-08-11 20:21:44,949 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.TaskSubscriber_add] DriverManager fetching connection for PlanetProjectDB via jdbc url jdbc:mysql://localhost:3306/PUBLIC === 2014-08-11 20:21:44,949 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.TaskSubscriber_add] Passing credentials getConnection separately from JDBC URL === 2014-08-11 20:21:44,964 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.TaskSubscriber_add] makeObject() created a pooled Connection '697499' === 2014-08-11 20:21:44,964 [sor2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.TaskSubscriber_add] Executing pingTest 'select 1 from dual' on connection 697499 === 2014-08-11 20:21:44,964 [sor2] DEBUG SQLConnectionManager - [builtinApplication.TaskSubscriber_add] Returning borrowed connection '697499' === 2014-08-11 20:21:44,980 [sor2] DEBUG SQLTransaction - [builtinApplication.TaskSubscriber_add] Started new PlanetProjectDB transaction "697499" === 2014-08-11 20:21:44,980 [sor2] DEBUG SQLDriver - [builtinApplication.TaskSubscriber_add] About to execute SQL update in 'PlanetProjectDB' using connection'697499' === 2014-08-11 20:21:44,980 [sor2] INFO SQLDriver - [builtinApplication.TaskSubscriber_add] Executing SQL update on 'PlanetProjectDB': INSERT INTO PUBLIC.TaskSubscriber (AnyChangeOption, CommunityID, DueReminderDate, DueReminderOption, DueReminderTime, ProjectID, StatusChangeOption) VALUES (0, 101, '2014-08-11', 0, '1970-01-01 08:00:00', 102, 1) === 2014-08-11 20:21:45,011 [sor2] DEBUG SQLDriver - [builtinApplication.TaskSubscriber_add] FAILED to execute SQL update in 'PlanetProjectDB' using connection'697499' === 2014-08-11 20:21:45,011 [sor2] WARN RequestContext - dsRequest.execute() failed: java.sql.SQLException: Field 'TaskID' doesn't have a default value at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2355) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:774) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:724) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:848) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:427) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1477) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:314) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:266) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1370) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:723) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2042) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.isomorphic.js.JSSyntaxScannerFilter.doFilter(JSSyntaxScannerFilter.java:242) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:260) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:722)
Code:
isc.DataSource.create({ ID:"TaskSubscriber", autoDeriveSchema:true, dataSourceVersion:1, dbName:"PlanetProjectDB", schema:"PUBLIC", serverType:"sql", tableName:"TaskSubscriber", fields:{ TaskID:{ name:"TaskID", primaryKey:true, type:"integer" }, ProjectID:{ name:"ProjectID", required:true, type:"integer" }, CommunityID:{ name:"CommunityID", required:true, type:"integer" }, OrganizationName:{ canEdit:false, detail:false, name:"OrganizationName", required:false, title:"Organization", type:"text", tableName:"Organization" }, Internal:{ canEdit:false, name:"Internal", required:false, sqlStorageStrategy:"integer", title:"Internal", type:"boolean", tableName:"Organization" }, TeamMemberID:{ name:"TeamMemberID", primaryKey:true, type:"integer" }, TeamMemberName:{ canEdit:false, detail:false, name:"TeamMemberName", title:"Subscriber", type:"text", tableName:"TeamMember" }, Enabled:{ canEdit:false, name:"Enabled", required:false, sqlStorageStrategy:"integer", title:"Enabled", type:"boolean", tableName:"TeamMember" }, TeamMemberEmail:{ canEdit:false, length:64, name:"TeamMemberEmail", title:"Email", type:"text", tableName:"TeamMember" }, TeamMemberSMS:{ canEdit:false, length:64, name:"TeamMemberSMS", title:"SMS", type:"text", tableName:"TeamMember" }, EmailAlertOption:{ canEdit:false, name:"EmailAlertOption", required:false, sqlStorageStrategy:"integer", title:"Email Alerts", type:"boolean", tableName:"TeamMember" }, SmsAlertOption:{ canEdit:false, name:"SmsAlertOption", required:false, sqlStorageStrategy:"integer", title:"SMS Alerts", type:"boolean", tableName:"TeamMember" }, IssueOwnerAlerts:{ canEdit:false, name:"IssueOwnerAlerts", required:false, sqlStorageStrategy:"integer", title:"Auto Issue Alerts", type:"boolean", tableName:"TeamMember" }, TaskOwnerAlerts:{ canEdit:false, name:"TaskOwnerAlerts", required:false, sqlStorageStrategy:"integer", title:"Auto Task Alerts", type:"boolean", tableName:"TeamMember" }, AnyChangeOption:{ canEdit:true, name:"AnyChangeOption", required:true, sqlStorageStrategy:"integer", title:"Any Change Option", type:"boolean" }, StatusChangeOption:{ canEdit:true, name:"StatusChangeOption", required:true, sqlStorageStrategy:"integer", title:"Status Change Option", type:"boolean" }, DueReminderOption:{ canEdit:true, name:"DueReminderOption", required:true, sqlStorageStrategy:"integer", title:"Due Reminder Option", type:"boolean" }, DueReminderDate:{ name:"DueReminderDate", type:"date" }, DueReminderTime:{ name:"DueReminderTime", type:"time" }, Created:{ detail:true, name:"Created", type:"datetime" }, Modified:{ detail:true, name:"Modified", type:"datetime" } }, operationBindings:[ { operationType:"fetch", tableClause:"TaskSubscriber LEFT JOIN TeamMember ON TaskSubscriber.TeamMemberID = TeamMember.TeamMemberID LEFT JOIN Organization ON TeamMember.OrganizationID = Organization.OrganizationID ", whereClause:"($defaultWhereClause)" } ], title:"TaskSubscriber", pluralTitle:"TaskSubscribers", generatedBy:"v8.2p_2013-01-14/EVAL Deployment 2013-01-14" })
Code:
<DataSource ID="TaskSubscriber" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" tableName="TaskSubscriber" autoDeriveSchema="true"> <fields> <field name="TaskID" type="integer" required="true" primaryKey="true"/> <field name="ProjectID" required="true" type="integer"/> <field name="CommunityID" required="true" type="integer"/> <field name="OrganizationName" type="text" required="false" title="Organization" detail="false" canEdit="false"> <tableName>Organization</tableName> </field> <field name="Internal" type="boolean" required="false" title="Internal" canEdit="false" sqlStorageStrategy="integer"> <tableName>Organization</tableName> </field> <field name="TeamMemberID" type="integer" required="true" primaryKey="true"/> <field name="TeamMemberName" type="text" title="Subscriber" detail="false" canEdit="false"> <tableName>TeamMember</tableName> </field> <field name="Enabled" type="boolean" required="false" title="Enabled" canEdit="false" sqlStorageStrategy="integer"> <tableName>TeamMember</tableName> </field> <field name="TeamMemberEmail" type="text" length="64" title="Email" canEdit="false"> <tableName>TeamMember</tableName> </field> <field name="TeamMemberSMS" type="text" length="64" title="SMS" canEdit="false"> <tableName>TeamMember</tableName> </field> <field name="EmailAlertOption" type="boolean" required="false" title="Email Alerts" canEdit="false" sqlStorageStrategy="integer"> <tableName>TeamMember</tableName> </field> <field name="SmsAlertOption" type="boolean" required="false" title="SMS Alerts" canEdit="false" sqlStorageStrategy="integer"> <tableName>TeamMember</tableName> </field> <field name="IssueOwnerAlerts" type="boolean" required="false" title="Auto Issue Alerts" canEdit="false" sqlStorageStrategy="integer"> <tableName>TeamMember</tableName> </field> <field name="TaskOwnerAlerts" type="boolean" required="false" title="Auto Task Alerts" canEdit="false" sqlStorageStrategy="integer"> <tableName>TeamMember</tableName> </field> <field name="AnyChangeOption" type="boolean" required="true" title="Any Change Option" canEdit="true" sqlStorageStrategy="integer"/> <field name="StatusChangeOption" type="boolean" required="true" title="Status Change Option" canEdit="true" sqlStorageStrategy="integer"/> <field name="DueReminderOption" type="boolean" required="true" title="Due Reminder Option" canEdit="true" sqlStorageStrategy="integer"/> <field name="DueReminderDate" type="date"/> <field name="DueReminderTime" type="time"/> <field name="Created" type="datetime" detail="true"/> <field name="Modified" type="datetime" detail="true"/> </fields> <operationBindings> <OperationBinding> <operationType>fetch</operationType> <tableClause>TaskSubscriber LEFT JOIN TeamMember ON TaskSubscriber.TeamMemberID = TeamMember.TeamMemberID LEFT JOIN Organization ON TeamMember.OrganizationID = Organization.OrganizationID </tableClause> <whereClause>($defaultWhereClause)</whereClause> </OperationBinding> </operationBindings> <title>TaskSubscriber</title> <pluralTitle>TaskSubscribers</pluralTitle> <generatedBy>v8.2p_2013-01-14/EVAL Deployment 2013-01-14</generatedBy> </DataSource>
Code:
CREATE TABLE TaskSubscriber( TaskID BIGINT NOT NULL, ProjectID BIGINT NOT NULL, CommunityID BIGINT NOT NULL, TeamMemberID BIGINT NOT NULL, AnyChangeOption TINYINT DEFAULT 0, StatusChangeOption TINYINT DEFAULT 0, DueReminderOption TINYINT DEFAULT 0, DueReminderDate DATE, DueReminderTime TIME, Created TIMESTAMP, Modified TIMESTAMP DEFAULT '2012-07-23 12:00:00', INDEX IDX_TaskSubscriber_DueReminderDate USING BTREE (DueReminderDate), CONSTRAINT IDX_TaskSubscriber_PK PRIMARY KEY (TaskID, TeamMemberID), CONSTRAINT IDX_TaskSubscriber_Task FOREIGN KEY (TaskID) REFERENCES Task (TaskID), CONSTRAINT IDX_TaskSubscriber_Project FOREIGN KEY (ProjectID) REFERENCES Project (ProjectID), CONSTRAINT IDX_TaskSubscriber_TeamMember FOREIGN KEY (TeamMemberID) REFERENCES TeamMember (TeamMemberID), CONSTRAINT IDX_TaskSubscriber_Community FOREIGN KEY (CommunityID) REFERENCES Community (CommunityID) );
Code:
isc.DynamicForm.create({ ID:"TaskSubscriberForm", autoDraw:false, dataSource:"TaskSubscriber", numCols:6, overflow:"hidden", fields:[ { name:"TaskID", visible:true, disabled:true, _constructor:"TextItem" }, { name:"ProjectID", visible:false, disabled:false, _constructor:"TextItem" }, { name:"CommunityID", endRow:true, visible:false, disabled:false, _constructor:"TextItem" }, { name:"TeamMemberID", title:"Team Member", width:300, colSpan:3, required:true, valueField:"TeamMemberID", displayField:"TeamMemberName", optionDataSource:TeamMember, optionOperationId:"excludeCurrentTaskSubscribers", cachePickListResults:"false", _constructor:"SelectItem" }, { canEdit:false, name:"TeamMemberName", title:"Team Member", width:300, visible:false, shouldSaveValue:false, disabled:false, _constructor:"TextItem" }, { name:"UndoButton", title:"UNDO", startRow:false, endRow:false, disabled:true, click:"Log.setPriority(\"Log\", 5);\nLog.logDebug(\"********************** TaskSubscribersForm.UndoButton.Click\");\n\n var form = this.form;\n form.reset();\n form.changesPending = false;\n form.newLogEntry = null;\n form.getItem(\"SaveButton\").setDisabled(true);\n form.getItem(\"UndoButton\").setDisabled(true);\n form.clearErrors(true);\n\nLog.logDebug(\"***END***END***END*** TaskSubscribersForm.UndoButton.Click\");", _constructor:"ButtonItem" }, { name:"SaveButton", title:"SAVE", startRow:false, disabled:true, // click:"", click:"\n Log.setPriority(\"Log\", 5);\n Log.logDebug(\"********************** TaskSubscriberForm.SaveButton.Click\");\n var form = this.form;\n if (form.validate(false)) {\n form.saveData();\n if (!form.hasErrors()) {\n oldValues = null;\n newValues = null;\n form.rememberValues();\n form.newLogEntry = null;\n form.getItem(\"SaveButton\").setDisabled(true);\n form.changesPending = false;\n TaskSubscriberWindow.closeClick();\n } else {\n alert(\"errors during save.\");\n }\n } else {\n alert(\"validation failed.\");\n }\n Log.logDebug(\"***END***END***END*** TaskSubscriberForm.SaveButton.Click\");", _constructor:"ButtonItem" }, { name:"AnyChangeOption", title:"Any Change Option", titleOrientation:"top", _constructor:"CheckboxItem" }, { name:"StatusChangeOption", title:"StatusChangeOption", titleOrientation:"top", prompt:"Select to be alerted on changes in status, due date or owner.", _constructor:"CheckboxItem" }, { name:"DueReminderOption", title:"Due Reminder Option", titleOrientation:"top", startRow:false, _constructor:"CheckboxItem" }, { name:"DueReminderDate", title:"Due Reminder Date", titleOrientation:"top", _constructor:"DateItem" }, { name:"DueReminderTime", title:"Due Reminder Time", titleOrientation:"top", _constructor:"TimeItem" } ], width:"100%", height:"100%", visibilityChanged:"", itemChanged:"Log.setPriority(\"Log\", 5);\nLog.logDebug(\"********************** TaskSubscribersForm.itemChanged\");\n\n this.getItem(\"SaveButton\").setDisabled(false);\n this.getItem(\"UndoButton\").setDisabled(false);\n\nLog.logDebug(\"***END***END***END*** TaskSubscribersForm.itemChanged\"); " })
Maybe a keen eye will see find where the values get lost.
I will start looking again after coffee in the AM.
Rick
P.S. I am running SmartClient Version: v8.3p_2014-06-27/EVAL on Mozilla Firefox 20.0 with Firebug using Windows 7 Premium 64 bit.
Comment