views:

142

answers:

1

I downloaded the DDD Sample Application (based on book by Eric Evans) and it uses a hsqldb. However, I can't seem to find how this db is set up. I opened the project in Intellij and everything builds like a charm. But nowhere do I find such a hsqldb... I'm not an experienced Java developer, so I'm probably missing something. Anyone that can answer this for me?

+3  A: 

HSQLDB (also called HypersonicDB) is usually used as an embedded SQL database in trivial java apps. You can download it here. It's very simple to set up, and usually works just by having the JAR file in your classpath, the sample app should have the appropriate config.

skaffman
And the db itself? I mean, the tables and data, can it be it's included in the jar?
Lieven Cardoen
@Lieven: That depends on how the app uses it. It's often a purely in-memory database. The app might choose to specify file storage, but you shouldn't have to do anything to make it work.
skaffman
So, jdbc:hsqldb:mem:dddsample, would be created automatically? And then hibernate would create the tables if their weren't any? I have the impression that the Persistence tests assume there's already data in the db, so I'm trying to find how the db is set up...
Lieven Cardoen
Yes, `jdbc:hsqldb:mem` will create an in-memory database on demand, and hibernate most likely is configured to create the tables on demand. The persistence tests may pre-load test data into the database.
skaffman
Great, thx, skaffman.
Lieven Cardoen