Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:36:47+00:00 2026-05-16T06:36:47+00:00

I am working on a Java application that will use some Hibernate (annotated by

  • 0

I am working on a Java application that will use some Hibernate (annotated by JPA) classes, backed by a HSQLDB datasource (DBCP BasicDataSource). I am trying to manually tweak the HSQLDB “.script” file (which I can’t for the life of me find the authoritative name for by web searching/reading the docs; it’s only mentioned in passing) to rapidly add some new in-memory tables for testing. The problem is, any errors that occur when HSQLDB is running this script don’t seem to be reported or logged anywhere. For instance, if I have an INSERT statement within that .script (a very common usage scenario to set up an initial dataset), and there is a problem with it (like incorrect date format, incorrect number of columns, etc.), nothing is ever reported, and there is no exception. I only notice later on when the HQL query I construct in the test case throws an exception due to a NULL result, which the program is not expecting since the data set should be initialized properly at that point.

The only reason I even figured out there was a problem with the INSERT statement was by performing them on a raw SQLConnection on the HSQLDB datasource, rather than doing them in the .script file, and observing the SQLExceptions that were thrown at that point.

Logging in general seems to be working and HSQLDB is logging tons of other messages of all thresholds very frequently during startup to stdout. So I’m flummoxed as to why those don’t include obvious SQLExceptions that must be getting thrown at some point.

Any ideas on what to try? Some configuration I’m missing, perhaps? I tried searching all through the HSQLDB docs to no avail, but that doesn’t necessarily mean the answer isn’t there. In case it matters, the usage scenario I’m trying to get this working for is a Spring application context initialized within a JUnit test case (via a FileSystemXmlApplicationContext object). Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:36:48+00:00Added an answer on May 16, 2026 at 6:36 am

    I don’t think this is supported simply because the script file containing the definition of tables and other database objects, plus the data for non-cached tables is not supposed to contain syntactically incorrect statements (they are supposed to be written by HSQLDB itself).

    But since you’re using Hibernate, my suggestion would to use the import.sql feature announced in the Rotterdam JBug and Hibernate’s import.sql blog post:

    import.sql: easily import data in your unit tests

    Hibernate has a neat little feature
    that is heavily under-documented and
    unknown. You can execute an SQL script
    during the SessionFactory creation
    right after the database schema
    generation to import data in a fresh
    database. You just need to add a file
    named import.sql in your classpath
    root and set either create or
    create-drop as your
    hibernate.hbm2ddl.auto property.

    I use it for Hibernate Search in
    Action
    now that I have started the
    query chapter. It initializes my
    database with a fresh set of data for
    my unit tests. JBoss Seam also uses it
    a lot in the various examples.
    import.sql is a very simple feature
    but is quite useful at time. Remember
    that the SQL might be dependent on
    your database (ah portability!).

    #import.sql file
    delete from PRODUCTS
    insert into PRODUCTS (PROD_ID, ASIN, TITLE, PRICE, IMAGE_URL, DESCRIPTION) values ('1', '630522577X', 'My Fair Lady', 19.98, '630522577X.jpg', 'My Fair blah blah...');
    insert into PRODUCTS (PROD_ID, ASIN, TITLE, PRICE, IMAGE_URL, DESCRIPTION) values ('2', 'B00003CXCD', 'Roman Holiday ', 12.98, 'B00003CXCD.jpg', 'We could argue that blah blah');
    

    For more information about this
    feature, check Eyal’s blog, he
    wrote a nice little entry about it.
    Remember if you want to add additional
    database objects (indexes, tables and
    so on), you can also use the auxiliary
    database objects feature.

    Another option would be to use DbUnit. But if (non) portability is not an issue, I’d use the import.sql trick.

    Related questions

    • How to execute differnet import.sql in Hibernate/JPA for each persistence unit?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It is fairly unwise, the CLR cannot find the DLL… May 16, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer Have you considered using Tesseract-OCR? As of version 3, tesseract… May 16, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer As linq statements involve Lambda expressions, which are a compiler… May 16, 2026 at 11:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm working on an application in Java, that needs to do some complex logic
Am working on a Java application that requires me to display PDF documents within
We are working on developing a Java EE based application. Our application is Java
All, I'm working on a java webapp that we deploy in the Resin web
I'm working on an application that I need to be cross-platform. I'd like to
I'm using PDF-Renderer to view PDF files within my java application. It's working perfectly
I am writing an application in java (1.6) using swing. I currently have a
TL DR; Want some Java help with connecting to a truly local database (
Where should I locate the code for validating an employee ID (badge) that will
I'm currently working on implementing the public API of our web application. The application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.