Issue 1:
Eric Fletcher opened SPR-3019 and commented

The issue appears to be a compatibility issue between Quartz1.6 JDBCJobStore and Spring scheduling.

When using a CronTriggerBean to persist a cron trigger a DataTruncationExceptions is being thrown when attempting to insert the trigger. The stack trace indicates that Quartz is trying to insert a new BlobTrigger instead of a CronTrigger.

The issue appears to be a change in how the org.quartz.impl.jdbcjobstore.StdJDBCDelegate checks to see what type of trigger is to be inserted. The code for the check in the older(1.5.2) version is shown below:

[code]

1166 if (trigger instanceof SimpleTrigger) {

1167 ps.setString(10, TTYPE_SIMPLE);

1168 } else if (trigger instanceof CronTrigger) {

1169 ps.setString(10, TTYPE_CRON);

1170 } else { // (trigger instanceof BlobTrigger)

1171 ps.setString(10, TTYPE_BLOB);

[/code]

In the older implementations of Quartz's org.quartz.impl.jdbcjobstore.StdJDBCDelegate, it was using an instanceof check to determine the trigger type. That was fine, since CronTriggerBean subclasses CronTrigger.

In Quartz version 1.6, the trigger type check is now relying on the getClass method, shown below:

[code]

if (trigger.getClass() == SimpleTrigger.class) {

ps.setString(10, TTYPE_SIMPLE);

} else if (trigger.getClass() == CronTrigger.class) {

ps.setString(10, TTYPE_CRON);

} else {

ps.setString(10, TTYPE_BLOB);

}

[/code]

In this case, the CronTriggerBean (or a SimpleTriggerBean) check is always going to return false, and Quartz is going to try to insert a BlobTrigger all the time, causing the data truncation exception.

There are a couple workarounds:

-Use the Trigger directly as a Bean instead of using CronTriggerBean

-Manually enter the trigger record to the database

-swap in the Quartz 1.5.2 jars for the 1.6 jars, start the app and insert the trigger, then go back to 1.6(if desired).

I stumbled across the last one and it is what I have tested so far. The other workarounds should work, but I haven't tested them.

This post also describes the issue:

http://forum.springframework.org/showthread.php?t=33301

Affects: 2.0 final

Issue Links:

#7537 Upgrade to Quartz 1.6.1 (for trigger persistence with SimpleTriggerBean and CronTriggerBean) ("duplicates")

Issue 2:
Ben Sion opened SPR-8210 and commented

It would be very helpful if the EmbeddedDatabaseBuilder could be configured to continue on error or ignore drop statements when executing schema and data scripts. This would simplify the use of the EmbeddedDatabase for use in unit tests (and probably other scenarios).

I have attached a patch for this issue. Basically a new constructor is added to the EmbeddedDatabaseBuilder taking in 2 booleans that configure the underlying DatabasePopulator's ignoreFailedDrops and continueOnError values.

I realise that I could create my own DatabasePopulator and execute the scripts outside of the EmbeddedDatabaseBuilder's initialisation but this seems like a lot of extra lines of code. Please let me know if I can provide more information.

Affects: 3.0.5, 3.1 M1

Attachments:

patch-embeddedDB.txt (2.95 kB)

Issue Links:

#16037 Improve configurability of EmbeddedDatabaseBuilder ("is superseded by")