are you sure, your transactions were commited and data were persisted successfully? It seems that, you need to commit transactions and possible also to flush the hibernate session manually to get transactions commited and data synchronized.
If you use the create-drop also the schema will be deleted, excepting the case, when the schema doesn't match your model anymore. I think, in your case the hbm2ddl=
updatedid work fine.
thank you for your answer. The entities are saved to database, I can see them when I access the database with SQuirreL or another
The code I use is as follows:
//inject session @In Session session; ... User user=new User(); user.setName("coolUser"); session.save(user); session.flush();
Do I have to care for anything concerning transactions? As mentioned, I disabled transaction management.
Sounds like one of the
Memory tables are the default type when the CREATE TABLE command is used. Their data is held entirely in memory but any change to their structure or contents is written to the <dbname>.script file. The script file is read the next time the database is opened, and the MEMORY tables are recreated with all their contents.
Another possible cause, if your connecting like this:
Memory-Only Databases It is possible to run HSQLDB in a way that the database is not persistent and exists entirely in random access memory. As no information is written to disk, this mode should be used only for internal processing of application data, in applets or certain special applications. This mode is specified by the mem: protocol. Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", "");
OK, thank you for this information.
I thought when using HSQL in server mode the database would store the data on disk (and not only the schema...). But it looks like this assumption was wrong.
So I will try with another database.
Do you have any proposals for a small, lightweight database system that does not need any installation or administration (like e.g. mySQL does)?
Sorry, your choices are pretty limited. Even HSQL requires some administration from time to time.
I highly recommend you read the documentation, it will save you a lot of time and frustration.
HSQL can store the information on disk. Create a properties file for the server and add the following property:
Documentation for HSQL can be found here.