<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=bdruth" rel="nofollow">Brice Ruth</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4506?redirect=false" rel="nofollow">SPR-4506</a></strong> and commented</p>
<p dir="auto">Setting 'autoStartup' property to 'false' on ServerSessionMessageListenerContainer causes an exception during initialization of the MDP container. Basically, autoStartup prevents the Connection from being setup, but something else in ServerSessionMessageListenerContainer#doInitialize needs (or expects) that Connection to be valid.</p>
<p dir="auto">Can provide full stack, if needed.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.5</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398084057" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8948" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8948/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8948">#8948</a> ServerSessionMessageListenerContainer102 cannot be initialized with autoStart=false (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=golliwog" rel="nofollow">Julian Sareyka</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8817?redirect=false" rel="nofollow">SPR-8817</a></strong> and commented</p>
<p dir="auto">I have tried to setup an in-memory db with hsql. In one of my scripts there is a stored procedure. Database setup fails when executing this script.</p>
<p dir="auto">I found out that this is due to automatic statement splitting in <code class="notranslate">ResourceDatabasePopulator</code>. Here all statements in a script are split on semicolons. So my stored procedure is cut into pieces (after <code class="notranslate">p_date_value DAY;</code>).</p>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="CREATE FUNCTION pkg_verweildauer.get_pub_ende (IN p_pub_start TIMESTAMP, IN p_date_unit VARCHAR(255), IN p_date_value NUMERIC) 
RETURNS timestamp
READS SQL DATA
BEGIN ATOMIC

DECLARE v_pub_ende timestamp;
case p_date_unit
	when 'DAYS' then
		SET v_pub_ende = p_pub_start + p_date_value DAY;
	when 'WEEKS' then
		SET v_pub_ende = TIMESTAMPADD(SQL_TSI_WEEK, p_date_value, p_pub_start);
	when 'MONTHS' then
		SET v_pub_ende = TIMESTAMPADD(SQL_TSI_MONTH, p_date_value, p_pub_start);
	when 'YEARS' then
		SET v_pub_ende = TIMESTAMPADD(SQL_TSI_YEAR, p_date_value, p_pub_start);
	else
		SET v_pub_ende = p_pub_start + 365 DAY;
end case;
RETURN v_pub_ende;

END;"><pre class="notranslate"><span class="pl-k">CREATE</span> <span class="pl-k">FUNCTION</span> <span class="pl-en">pkg_verweildauer</span>.get_pub_ende (<span class="pl-k">IN</span> p_pub_start <span class="pl-k">TIMESTAMP</span>, <span class="pl-k">IN</span> p_date_unit <span class="pl-k">VARCHAR</span>(<span class="pl-c1">255</span>), <span class="pl-k">IN</span> p_date_value <span class="pl-k">NUMERIC</span>) 
RETURNS <span class="pl-k">timestamp</span>
READS SQL DATA
<span class="pl-k">BEGIN</span> ATOMIC

DECLARE v_pub_ende <span class="pl-k">timestamp</span>;
case p_date_unit
	when <span class="pl-s"><span class="pl-pds">'</span>DAYS<span class="pl-pds">'</span></span> then
		<span class="pl-k">SET</span> v_pub_ende <span class="pl-k">=</span> p_pub_start <span class="pl-k">+</span> p_date_value DAY;
	when <span class="pl-s"><span class="pl-pds">'</span>WEEKS<span class="pl-pds">'</span></span> then
		<span class="pl-k">SET</span> v_pub_ende <span class="pl-k">=</span> TIMESTAMPADD(SQL_TSI_WEEK, p_date_value, p_pub_start);
	when <span class="pl-s"><span class="pl-pds">'</span>MONTHS<span class="pl-pds">'</span></span> then
		<span class="pl-k">SET</span> v_pub_ende <span class="pl-k">=</span> TIMESTAMPADD(SQL_TSI_MONTH, p_date_value, p_pub_start);
	when <span class="pl-s"><span class="pl-pds">'</span>YEARS<span class="pl-pds">'</span></span> then
		<span class="pl-k">SET</span> v_pub_ende <span class="pl-k">=</span> TIMESTAMPADD(SQL_TSI_YEAR, p_date_value, p_pub_start);
	else
		<span class="pl-k">SET</span> v_pub_ende <span class="pl-k">=</span> p_pub_start <span class="pl-k">+</span> <span class="pl-c1">365</span> DAY;
end case;
RETURN v_pub_ende;

END;</pre></div>
<p dir="auto">A simple solution would be to add a parameter to the <code class="notranslate">&lt;jdbc:script&gt;</code> tag to disable splitting on file basis. Unfortunately <code class="notranslate">ResourceDatabasePopulator</code> cannot be exchanged in the <code class="notranslate">EmbeddedDatabaseBuilder</code>.</p>
<p dir="auto">I had to write a post processing bean, to add the stored function.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.5</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398115829" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13525" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13525/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13525">#13525</a> Error when parsing PMS stored procedure script. (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398108406" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12356" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12356/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12356">#12356</a> Add configurable SQL statement delimiter to ResourceDatabasePopulator and JDBC XML namespace. (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398167565" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16310" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16310/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16310">#16310</a> Support EOF as statement separator in SQL scripts</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398183314" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/17970" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/17970/hovercard" href="https://github.com/spring-projects/spring-framework/issues/17970">#17970</a> Support triggers &amp; stored procedures alongside standard statements in SQL scripts</li>
</ul>
<p dir="auto">3 votes, 2 watchers</p>