Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using hibernate is a good possibility.</p> <p>Some <a href="http://hsqldb.org/" rel="nofollow noreferrer">embedded database exist</a> , so you could launch it when the application starts before starting hibernate.</p> <p>The advantage of course is that if you ever wanted to convert the code from standalone to server based, your java bean - hibernate - db model would work very well in that context as well. Serializing to your own format would be like making your own flat file database, and why write it again when it's already done for you And I was also going to suggest Apache Derby for embedded use (From: Java Drinker)</p> <p>For the migration part, the easiest way is then to have a version table in the database, telling you what is the current version, and then at the start of the application, after the database is started, but before creating the session factory (or entity manager) check the current database version, check in a sql migration file the last version, and if both do not match, exec all sql queries above the current db version.</p> <p>The migration file could look like that :</p> <pre><code>-- version:1 sql query 1 (update, alter, ...) -- version:2 sql query 2 ... </code></pre> <p>You will have to be very careful when you write the migration file. Always consider there is data in a table for example (never add a not nullable column in a table but instead add the column, update the column, and then add the non nullity constraint).</p> <p>[edit] </p> <ul> <li>First import part : </li> </ul> <p>If the database does not exist or is empty (for example the version table is not there), you start by creating the database and then start a migration from your old format to the database format. The code would look like: reading old data files, instantiating your hibernate/jpa entities, and persisting them. (you can also write more efficient code to produce directly sql queries, but that will need more time, and will be a lot harder to maintain when your jpa model change)</p> <ul> <li>export :</li> </ul> <p>The embedded database will have its own files on disk. It will be enough to share data between different workstations.<br> If you want to share the data with other apps, you will need to develop this opposite feature of import : loading all the needed entities from database and writing them to a different file format. It could be triggered from your application ui.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload