I am trying to finally change my datasources to autoDeriveSchema="true" but I now have another problem and I think it is a bug.
Entrypoint:
test.ds.xml
TestingDMI:
relSchuelerEltern.ds.xml
Table definition (MSSQL 2014):
Log:
As you see, in my table t_rel_schueler_eltern I have a composite primary key: (f_schueler_id, f_eltern_id). This seems not to work.
The other fields are being correctly autoDerived, but this composite primary key not.
Using smartgwt 5.0p power 2015-09-20 and MSSQL 2014.
Entrypoint:
Code:
public void onModuleLoad() { final VLayout vlayout = new VLayout(); IButton button = new IButton("go!"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { DataSource.get("test") .performCustomOperation("testDMI", new Record(), new DSCallback() { @Override public void execute( DSResponse dsResponse, Object data, DSRequest dsRequest) { SC.say("ok"); } }); } }); vlayout.addMember(button); vlayout.draw(); }
Code:
<DataSource ID="test" serverType="sql" tableName="t_rel_schueler_eltern"> <fields> <field name="f_id" type="sequence" primaryKey="true" /> </fields> <operationBindings> <operationBinding operationType="custom" operationId="testDMI"> <serverObject className="de.mks_infofabrik.kids.server.test.TestingDMI" methodName="testDMI" /> </operationBinding> </operationBindings> </DataSource>
Code:
public class TestingDMI { public DSResponse testDMI(DSRequest dsRequest) throws Exception { RPCManager rpcManager = dsRequest.getRPCManager(); DSRequest relAddRequest = new DSRequest("relSchuelerEltern", DataSource.OP_ADD, rpcManager); Map<String, Object> vals = new HashMap<>(); vals.put("f_schueler_id", 109); vals.put("f_eltern_id", 8919); vals.put("f_mandant", 1); relAddRequest.setValues(vals); relAddRequest.execute(); return new DSResponse(); } }
Code:
<DataSource ID="relSchuelerEltern" serverType="sql" tableName="t_rel_schueler_eltern" autoDeriveSchema="true" />
Code:
CREATE TABLE [dbo].[t_rel_schueler_eltern]( [f_schueler_id] [int] NOT NULL, [f_eltern_id] [int] NOT NULL, [f_typ] [char](7) NOT NULL, [f_mandant] [tinyint] NOT NULL, CONSTRAINT [PK_t_rel_schueler_eltern] PRIMARY KEY CLUSTERED ( [f_schueler_id] ASC, [f_eltern_id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
Code:
=== 2015-12-28 14:45:00,285 [c-10] DEBUG ISCKeyedObjectPool - Borrowing object for 'DataSource' === 2015-12-28 14:45:00,286 [c-10] DEBUG PoolableDataSourceFactory - Created DataSource 589 of type 'DataSource' and assigned it to thread http-nio-8080-exec-10 === 2015-12-28 14:45:00,286 [c-10] DEBUG PoolableDataSourceFactory - Created DataSource 589 of type 'DataSource' in the pooling flow === 2015-12-28 14:45:00,286 [c-10] DEBUG PoolableDataSourceFactory - Activated DataSource 589 of type 'DataSource' === 2015-12-28 14:45:00,287 [c-10] DEBUG PoolableDataSourceFactory - Created DataSource 590 of type 'List' and assigned it to thread http-nio-8080-exec-10 === 2015-12-28 14:45:00,287 [c-10] DEBUG PoolableDataSourceFactory - Created DataSource 590 of type 'List' in the pooling flow === 2015-12-28 14:45:00,287 [c-10] DEBUG PoolableDataSourceFactory - Activated DataSource 590 of type 'List' === 2015-12-28 14:45:00,288 [c-10] DEBUG ISCKeyedObjectPool - Borrowing object for 'elem' === 2015-12-28 14:45:00,288 [c-10] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'elem' in the pooling flow === 2015-12-28 14:45:00,288 [c-10] DEBUG RPCManager - Processing 1 requests. === 2015-12-28 14:45:00,289 [c-10] DEBUG ISCKeyedObjectPool - Borrowing object for 'test' === 2015-12-28 14:45:00,289 [c-10] DEBUG PoolableDataSourceFactory - Activated DataSource 587 of type 'test' === 2015-12-28 14:45:00,289 [c-10] DEBUG DSRequest - Caching instance 587 of DS 'test' from DSRequest.getDataSource() === 2015-12-28 14:45:00,289 [c-10] DEBUG DSRequest - Caching instance 587 of DS test === 2015-12-28 14:45:00,289 [c-10] DEBUG RPCManager - Request #1 (DSRequest) payload: { values:{ }, operationConfig:{ dataSource:"test", repo:null, operationType:"custom", textMatchStyle:"exact" }, appID:"builtinApplication", operation:"testDMI", oldValues:{ }, criteria:{ } } === 2015-12-28 14:45:00,290 [c-10] INFO IDACall - Key[type=com.isomorphic.servlet.IDACall, annotation=[none]] - Performing 1 operation(s) === 2015-12-28 14:45:00,290 [c-10] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2015-12-28 14:45:00,290 [c-10] DEBUG DeclarativeSecurity - DataSource test is not in the pre-checked list, processing... === 2015-12-28 14:45:00,295 [c-10] DEBUG ISCKeyedObjectPool - Borrowing object for 'relSchuelerEltern' === 2015-12-28 14:45:00,295 [c-10] DEBUG PoolableDataSourceFactory - Activated DataSource 160 of type 'relSchuelerEltern' === 2015-12-28 14:45:00,295 [c-10] DEBUG DSRequest - Caching instance 160 of DS 'relSchuelerEltern' from DSRequest.getDataSource() === 2015-12-28 14:45:00,295 [c-10] DEBUG DSRequest - Caching instance 160 of DS relSchuelerEltern === 2015-12-28 14:45:00,295 [c-10] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2015-12-28 14:45:00,295 [c-10] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application === 2015-12-28 14:45:00,295 [c-10] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation === 2015-12-28 14:45:00,296 [c-10] INFO SQLDataSource - [builtinApplication.null] Performing add operation with criteria: {f_eltern_id:8919,f_mandant:1,f_schueler_id:109} values: {f_eltern_id:8919,f_mandant:1,f_schueler_id:109} === 2015-12-28 14:45:00,298 [c-10] DEBUG SQLValuesClause - [builtinApplication.null] Sequences: {f_eltern_id=__default, f_schueler_id=__default} === 2015-12-28 14:45:00,301 [c-10] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '105478891' === 2015-12-28 14:45:00,302 [c-10] DEBUG SQLTransaction - [builtinApplication.null] Started new SQLSERVER transaction "105478891" === 2015-12-28 14:45:00,302 [c-10] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL update in 'SQLSERVER' using connection'105478891' === 2015-12-28 14:45:00,302 [c-10] INFO SQLDriver - [builtinApplication.null] Executing SQL update on 'SQLSERVER': INSERT INTO t_rel_schueler_eltern (f_mandant) VALUES (1) === 2015-12-28 14:45:00,309 [c-10] DEBUG SQLDriver - [builtinApplication.null] Found 2 sequence(s)/autoGenerated PK field(s): [f_schueler_id, f_eltern_id] === 2015-12-28 14:45:00,309 [c-10] DEBUG SQLDriver - [builtinApplication.null] Discovered zero or more generated key(s) via JDBC: {} === 2015-12-28 14:45:00,311 [c-10] DEBUG SQLDriver - [builtinApplication.null] FAILED to execute SQL update in 'SQLSERVER' using connection'105478891' === 2015-12-28 14:45:00,311 [c-10] DEBUG DSRequest - freeOnExecute is false for request of type add on DataSource relSchuelerEltern - not freeing resources! === 2015-12-28 14:45:00,311 [c-10] DEBUG DataSourceDMI - Invocation threw exception com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'f_schueler_id', table 'kids.dbo.t_rel_schueler_eltern'; column does not allow nulls. INSERT fails. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:902) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:804) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:989) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:579) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:2013) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:452) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:405) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1950) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726) 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:2548) at de.mks_infofabrik.kids.server.test.TestingDMI.testDMI(TestingDMI.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:975) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2544) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:220) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:185) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152) at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:117) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at de.mks_infofabrik.kids.server.filter.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:50) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) === 2015-12-28 14:45:00,313 [c-10] DEBUG DSRequest - About to free up resources for request of type custom on DataSource test === 2015-12-28 14:45:00,313 [c-10] DEBUG DSRequest - Ignoring freeResources call because this is not a primary request! === 2015-12-28 14:45:00,314 [c-10] WARN RequestContext - dsRequest.execute() failed: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert the value NULL into column 'f_schueler_id', table 'kids.dbo.t_rel_schueler_eltern'; column does not allow nulls. INSERT fails. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:902) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:804) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:989) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:579) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:2013) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:452) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:405) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1950) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726) 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:2548) at de.mks_infofabrik.kids.server.test.TestingDMI.testDMI(TestingDMI.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:975) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2544) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:220) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:185) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152) at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:117) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at de.mks_infofabrik.kids.server.filter.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:50) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:83) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) === 2015-12-28 14:45:00,314 [c-10] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8 === 2015-12-28 14:45:00,315 [c-10] DEBUG SQLTransaction - Rolling back SQLSERVER transaction "105478891" === 2015-12-28 14:45:00,315 [c-10] DEBUG RPCManager - non-DMI response, dropExtraFields: false === 2015-12-28 14:45:00,317 [c-10] DEBUG DSRequest - Ignoring freeQueueResources call because this is not a primary request! === 2015-12-28 14:45:00,317 [c-10] DEBUG SQLTransaction - getConnection() found transactional connection for SQLSERVER with hashcode "105478891" === 2015-12-28 14:45:00,317 [c-10] DEBUG SQLTransaction - Ending SQLSERVER transaction "105478891" === 2015-12-28 14:45:00,317 [c-10] DEBUG SQLConnectionManager - About to close connection with hashcode "105478891" === 2015-12-28 14:45:00,317 [c-10] DEBUG PoolableDataSourceFactory - Cleared and passivated DataSource 587 of type 'test' === 2015-12-28 14:45:00,317 [c-10] DEBUG PoolableDataSourceFactory - Cleared and passivated DataSource 160 of type 'relSchuelerEltern' === 2015-12-28 14:45:00,318 [c-10] INFO Compression - /kids-dev/V010402SNAPSHOT/sc/IDACall: 276 -> 220 bytes
The other fields are being correctly autoDerived, but this composite primary key not.
Using smartgwt 5.0p power 2015-09-20 and MSSQL 2014.
Comment