Missing Sequences in HSQL for testing Missing Sequences in HSQL for testing oracle oracle

Missing Sequences in HSQL for testing


I solved this by manually creating sequences as part of my test script. Not ideal as I would rather Spring/HSQL combination set this up. My code is:

for (String sequence : sequences) {    entityManager.createNativeQuery("DROP SEQUENCE " + sequence + " IF EXISTS").executeUpdate();    entityManager.createNativeQuery("CREATE SEQUENCE " + sequence + " as INTEGER").executeUpdate();}

where sequences is a list of string which are the sequence name.

I used this is the @BeforeClass method for each test class. Not ideal but it does solve the problem


Try the H2 database instead; it has a feature called "Compatibility Modes" in which it behaves like Oracle or HSQL.

When selecting the Oracle mode, you should be able to initialize the database with the same scripts (or Hibernate setup) that you use for your production.


You can build your own in-memory-db via script : how-to-initialize-in-memory-hsqldb-using-script-via-spring.

But I prefer using arquillian for integration testing with data.

Disclosure : not working for arquillian.