Home JPA with multiple long-running MSSQL stored procedures
Reply: 0

JPA with multiple long-running MSSQL stored procedures

user1564 Published in July 17, 2018, 3:28 pm

We have a MSSQL stored procedure that we are trying to run from within a Spring Boot application. The problem is this stored procedure is poorly written and too complicated for us to rewrite in a reasonable time. It would seem the crux of the problem is the way this stored procedure was written; it throws multiple warnings to the caller during its course of execution.

All the warning codes are less than 20 (mostly 16), and according to the documentation these are informational and not cause for failure. However, (we think) the warnings cause JPA (or the JDBC driver for MSSQL, its not clear which) to think the query is done. The query doesn't actually return anything, it just does a bunch of joins, calculations, and insertions that probably should have been written as a function instead of a stored procedure.

The JPA code is pretty simple:

        procedureQuery = entityManager.createStoredProcedureQuery(ProcessDataRulesExecutor.DATA_RULES_PROC);
        Boolean retVal = procedureQuery.execute();
        log.debug("Call to stored proc returned: ", retVal);

And retVal is set to true so that much works ok.

I'm not going to share the proc, there are children present. Suffice it to say that it works fine from SSMS and .Net applications. We only have issues with it when running in Java.

My question is, is there a flag I can set somewhere that would tell JPA/JDBC to ignore any warnings thrown and only stop the query when it returns a return 'code'?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.438228 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO