I'm new to SoapUI and Groovy, but an experienced Java programmer.
I created a TestCase with two Test Steps:
Properties step called CID with single property correlationID and value ${=java.util.UUID.randomUUID()}.
Test Request where I put <CorrelationID>${correlationID}</CorrelationID> in the request.
It works perfectly and submits unique CorrelationID value every time I run my tests.
Now I want to add new Script Assertion to Test Step 2 (Test Request) that compares computed correlationID property value from Test Step 1 (CID) with some data from Test Step 2 response. The problem is that I can not seem to be able to access generated value of correlationID from there.
If I try this: log.info "${correlationId}"
I get: No such property: correlationId for class: Script19
If I try this: log.info "${CID#correlationId}"
I get:
startup failed:
Script43.groovy: 1: unexpected char: '#' # line 1, column 16.
log.info "${CID#correlationId}"
^
org.codehaus.groovy.syntax.SyntaxException: unexpected char: '#' # line 1, column 16.
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:97)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:71)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:158)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:814)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:511)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
at groovy.lang.GroovyShell.parse(GroovyShell.java:739)
at groovy.lang.GroovyShell.parse(GroovyShell.java:766)
at groovy.lang.GroovyShell.parse(GroovyShell.java:757)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93)
at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:116)
at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:133)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:156)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequest.assertResponse(WsdlTestRequest.java:189)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequest.setResponse(WsdlTestRequest.java:159)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.run(WsdlTestRequestStep.java:346)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:207)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Script43.groovy:1:16: unexpected char: '#'
at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:695)
at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:248)
at groovyjarjarantlr.TokenBuffer.fill(TokenBuffer.java:69)
at groovyjarjarantlr.TokenBuffer.LA(TokenBuffer.java:80)
at groovyjarjarantlr.LLkParser.LA(LLkParser.java:52)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.nls(GroovyRecognizer.java:780)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.openOrClosableBlock(GroovyRecognizer.java:8848)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.stringConstructorValuePart(GroovyRecognizer.java:13449)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.stringConstructorExpression(GroovyRecognizer.java:11932)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.primaryExpression(GroovyRecognizer.java:11091)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.argumentLabel(GroovyRecognizer.java:10863)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.commandArgument(GroovyRecognizer.java:10756)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.commandArguments(GroovyRecognizer.java:10173)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expressionStatement(GroovyRecognizer.java:8948)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.statement(GroovyRecognizer.java:1258)
at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:650)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:93)
... 31 more
1 error
How can I access that correlationId computed value from my assertion Groovy script?
Thank you
The problem with my approach was that even if I do access the property, it is dynamic and my UUID is different each time I read the value of the property.
Instead I replaced my Properties test step with Setup Script of the Test Case:
uuid = context.expand('${=java.util.UUID.randomUUID()}')
testRunner.testCase.setPropertyValue("correlationID", uuid)
Each time my test case executes, a new uuid is generated. Then future test steps may access this static test case level property.
In my Test Request I use:
<CorrelationID>${#TestCase#correlationID}</CorrelationID>
In script assertion I use:
correlationID = context.expand('${#TestCase#correlationID}')
Thanks to Unhandled from SoapUI forums.
Wanted to add that context.getPropertyNames() or context.getProperties() does not list the properties defined in a 'Property' Test step.
Only context.expand('') works.
To get the property names of current Test Step from Script Assertion, we can use the following codes -
def testStepProp = context.getCurrentStep().getPropertyNames()
for(i=0; i<testStepProp.size(); i++){
log.info testStepProp[i]
}
To get the property names of current Test Case from Script Assertion, we can use the following codes:
def testCaseProp = context.testCase.getPropertyNames()
for(i=0; i<testCaseProp .size(); i++){
log.info testCaseProp[i]
}
To get a property value from script Assertion:
For Example if my property name is 'correlationID' -
def myValue = context.testCase.getPropertyValue("correlationID") //If we are in same testCase
def myValue = context.testCase.testSuite.testCases["testCaseName"].getPropertyValue("correlationID") //If we are in different testCase
Please note that 'testRunner' doesn't work in script Assertion. Instead we need to use context.
Related
I am trying to automate Salesforce instance using Tosca ,and i used "Automated Data Driven test cases" which is simply Recording of Test cases option using the Tosca tool ,after successful recording when i tried to execute the test case by "Run in scrapbook " option ,i see error as
No suitable value found for command 'XL'
Strange because i see values got populated in Tosca Test engine of excel generated as a result of recording
here
Here is detailed error log from Tosca
Tricentis.Automation.AutomationInstructions.TestActions.InvalidActionException: No suitable value found for command 'XL' ---> System.InvalidOperationException: No suitable value found for command 'XL'
at Tricentis.Automation.AutomationInstructions.Dynamic.Values.ValueFactory.CreateValues(IParsed parsed, DataType dataType)
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Tricentis.Automation.AutomationInstructions.Dynamic.Values.ValueFactory.CreateValue(IEnumerable`1 parsedItems, DataType dataType)
at Tricentis.Automation.AutomationInstructions.Dynamic.ExpressionParser.ParseExpression(String expression, IEnumerable`1 tokenDefinitions, DataType dataType)
at Tricentis.Automation.AutomationInstructions.Dynamic.ExpressionParser.GetAsValues[T](String expression, TokenDefinitionSet tokenDefinitionSet, DataType dataType)
at Tricentis.Automation.AutomationInstructions.TestActions.AutomationObjectTestAction.get_Values()
at Tricentis.Automation.AutomationInstructions.TestActions.AutomationObjectTextBoxTestAction.get_Values()
at Tricentis.Automation.AutomationInstructions.TestActions.AutomationObjectTestAction.CreateSubTestActions()
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.get_InnerActions()
--- End of inner exception stack trace ---
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.get_InnerActions()
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.get_Actions()
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.<>c.<get_ExecutableChildren>b__32_1(ITestAction testAction)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.get_ExecutableChildren()
at Tricentis.Automation.AutomationInstructions.TestActions.TestAction.get_ConstrainingChildren()
at Tricentis.Automation.AutomationInstructions.TestActions.AutomationObjectSearchQuery.get_TestActionConstraints()
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.get_ConstrainingChildTestActions()
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.ConstrainBySubItems(IEnumerable`1 representations)
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.ConstrainInternal(IEnumerable`1 representations, IModuleAttributeXParameters parameters)
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.Constrain(IEnumerable`1 representations)
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.SearchRepresentations(IAdapterController adapterController)
at Tricentis.Automation.Engines.Representations.Controllers.RootRepresentationController.SearchRepresentation()
at Tricentis.Automation.Engines.Representations.Controllers.RepresentationController.Search()
at ᜁ.ᜀ(IRepresentationController A_0)
at ᜁ.ᜁ(IRepresentationController A_0, IRepresentation& A_1)
at ᜂ.ᜀ(IRepresentationController A_0, IRepresentation& A_1)
at ᜁ.ᜀ()
Even I got the same error message. but now solved. I tried as below:
Converted test case to template and added the Test Sheet attributes to Template by drag n drop in respective locations. If you try to run the test steps at this point then you will get this error message "No Suitable Value found for command 'XL'",
This can be avoided by "Create Template Instance" from the menu or Instantiate icon from the icon from the tool bar and then run the instantiated item in Scratch Book. It should work without any error message. I used multiple user cased and all of them worked.
Note: other observation: make sure you do not delete the Values in the cells using right click and cross mark. just get in to cell and then remove.
You get this "No Suitable Value found for command 'XL'" when you try to run testcase from a template and not the template instance!!
I was trying to delete the old history of builds using a groovy script, and earlier it was working fine and without any changes now I am facing issue as below:
ERROR: Build step failed with exception
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method hudson.model.Item getName
at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:175)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:137)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at Script1.deleteBuildHistory(Script1.groovy:71)
at Script1$deleteBuildHistory.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at Script1.run(Script1.groovy:58)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:141)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:333)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1798)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute system Groovy script' marked build as failure
Finished: FAILURE
In my groovy I am using the API "hudson.model.Hudson.instance.getItem(envVar.get("JOB_NAME"));" to get the Jenkins job name. Since it is working earlier, now I am facing this issue and not sure how to resolve the same. Kindly provide inputs.
You are using a rather generic way to access data from an object, which might be exploited somehow, so it got blacklisted or rather not whitelisted in Jenkins Groovy Sandbox.
You have several options here:
Just add an exception using in-process script approval
Use a less generic and therefore saver syntax like env.JOB_NAME.
I would definitely go for the second option in your case for it has no disadvantages and is simpler then your current code.
As for why it worked before: three might have been an approval, which somehow got lost –happened to me once– or the call you are using got un-whitelisted in an update of the security plugin.
I am getting an exception when my column name contains hyphen "-"
Entity : this is the entity name.
#Entity
#Table(name = "RequestHeader")
public class RequestHeader implements Serializable {
....
....
#Column(name = "`oh-ordnbr`")
private Integer ohOrdnbr;
Schema definition: This is the query for schema creation.
CREATE MEMORY TABLE PUB.REQUESTHEADER(
REQUESTID INTEGER,
IMUSERID INTEGER,
REQUESTDATE DATE,
REQUESTTIME INTEGER,
REQUESTSTATUS VARCHAR(19),
REQUESTTYPE VARCHAR(22),
HEADERINSTRUCTIONS VARCHAR(5150),
DATEFORMAT VARCHAR(20),
TIMEFORMAT VARCHAR(20),
LANGUAGEID INTEGER,
"OH-ORDNBR" INTEGER,
"OH-TRCNSTAMP" INTEGER,
ISPICKUPLIST BIT(1),
CONSTRAINT "RQH-1" PRIMARY KEY(REQUESTID)
);
The error is below:
Exception Stack: Error message which I have received by running the Junit.
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: THIS_.oh-ordnbr
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ExpressionColumn.checkColumnsResolved(Unknown Source)
at org.hsqldb.QueryExpression.resolve(Unknown Source)
at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
Could some one help me in fixing this?
The reason for the object not found error is the fact that the oh-ordnbr column is defined to be case sensitive (this is due to the double quotes you put around it).
You have two possible solutions:
Do not use dashes (hyphens) in your SQL. It is bad practice anyway, use underscores instead.
Update the JPA annotation as follows:
#Column(name = "`OH-ORDNBR`")
private Integer ohOrdnbr;
I strongly recommend using underscores instead of dashes, you never know what weirdness different JPA implementations might have when using the second solution.
Check your configuration file has correct provider, I fixed same issue by providing org.hibernate.ejb.HibernatePersistence provider.
If HSQL Scripts are run via Java and if any new table query is followed by select/alter/update queries it always throws "user lacks privilege object". In reality the create queries after execution with Java Statements never gets commited into the DB and it is not persisted and we run our select/alter/update and it results in the exception. If we run the queries line by line and commit for each line, we could avoid this error.
I know the id of a test that is in a Testset and want to update your status, know how to do it using the API OTA?
Edit:
Thanks but current answer unfortunately doesn't work for me .
I put the example ( java) :
ITestSetFactory sTestFactory = (itdc.testSetFactory()).queryInterface(ITestSetFactory.class);
ITDFilter filterF=sTestFactory.filter().queryInterface(ITDFilter.class);
filterF.filter("TC_TEST_ID","531729");
System.out.println(filterF.newList().count());
The error:
Exception in thread "main" com4j.ComException: 800403ea (Unknown error) : Failed to Get Test Set Value : .\invoke.cpp:517
at com4j.Wrapper.invoke(Wrapper.java:166)
at com.sun.proxy.$Proxy13.newList(Unknown Source)
at TestQC.main(TestQC.java:64)
Any suggestions ?
The error occurs because you use the TestSetFactory instead of the TSTestFactory. You should use itdc.tsTestFactory() because it is TSTest objects you want to manipulate (aka test instances), not TestSet objects. The simplest way is to get the TSTestFactory of your TDConnection object, and use a filter to get the TSTest object and then set its status. Example code in Ruby:
ts_test_factory = tdc.TSTestFactory
filter = ts_test_factory.Filter
filter["TC_TEST_ID"] = "123" # test id from test plan
found_test_instances = filter.NewList
test_instance = found_test_instances.Item(1) # be careful if the test occurs in many test sets
test_instance.Status = "Passed"
test_instance.Post
I am using HSQLDB as my database. i want to get a primary key of latest inserted row. for that i have return a query in my java class as below:
final String query = "INSERT INTO polling_log (start_date,status,action) VALUES(CURRENT_TIMESTAMP,?,?); CALL IDENTITY();";
GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();
int update = adapterJdbcTemplate.update(new PreparedStatementCreator() {
#Override
public PreparedStatement createPreparedStatement(
Connection connection) throws SQLException {
PreparedStatement preparedStatement = connection
.prepareStatement(query);
preparedStatement.setInt(1, pollingLogVO.getStatus());
preparedStatement.setString(2, pollingLogVO.getAction());
System.out.println(preparedStatement.getGeneratedKeys().getFetchSize());
return preparedStatement;
}
}, generatedKeyHolder);
System.out.println("###################### "+ update);
Number logId = generatedKeyHolder.getKey();
pollingLogId = logId.intValue();
and to store the query i have used GeneratedKeyHolder. but while runing this i get an exception:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar []; nested exception is java.sql.SQLException: unexpected token: IDENTITY
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:817)
at com.platysgroup.lmex.adapter.moodle.dao.LogDao.insertPollingLog(LogDao.java:36)
at com.platysgroup.lmex.adapter.MoodlePostingTask.insertPollingLog(MoodlePostingTask.java:134)
at com.platysgroup.lmex.adapter.MoodlePostingTask.run(MoodlePostingTask.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.sql.SQLException: unexpected token: IDENTITY
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:248)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)
at com.platysgroup.lmex.adapter.moodle.dao.LogDao$1.createPreparedStatement(LogDao.java:41)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580)
... 6 more
Caused by: org.hsqldb.HsqlException: unexpected token: IDENTITY
at org.hsqldb.error.Error.parseError(Unknown Source)
at org.hsqldb.ParserBase.unexpectedToken(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 12 more
The problem is with this line (wrapped for clarity):
final String query = "INSERT INTO polling_log (start_date,status,action) VALUES(CURRENT_TIMESTAMP,?,?); CALL IDENTITY();";
The issue is that IDENTITY is a reserved word in SQL; it's got a meaning pre-defined already and so can't be used like that in a CALL statement. (I don't know what it is actually used for; the full definition of SQL is huge and has a very large number of reserved words.) The immediate work around would be to enclose the problem word in double quotes (which would need to be backslash-quoted because of being in a Java string):
final String query = "INSERT INTO polling_log (start_date,status,action) VALUES(CURRENT_TIMESTAMP,?,?); CALL \"IDENTITY\"();";
However, if you're just calling that to get the inserted row, STOP! Just let Spring do the work for you, assuming you have JDBC 3.0 or later (i.e., Java 5 or later).
As far as I know you cannot put more than one statements into one string to be executed. Execute two separate operations instead of this.
The following link has what you need:
http://www.devdaily.com/blog/post/jdbc/spring-jdbc-insert-auto-generated-key