The persistence.xml file mentions the possibility of using your own data source rather than the default data source to hit a different database.
When you use the embedded container, it looks for a file called embedded-jboss-beans.xml for its datasources (and several other things). In the one that ships with the ALPHA 9 release, you’ll see the following two entries near the bottom:
To create your own data source, you basically copy both of these and update the values accordingly. Here is one example that uses HSQL with a local server:
To use this, you need to do two things. Update persistence.xml and start a HSQL server.
Update persistence.xml
Replace the following line:
With this one:
To start an HSQL server, you can use the following steps:
Under the place where you extracted HSQL (C:\libs\hsqldb if you used the same directories as the tutorial), create a new directory called “databases”.
Change to that directory
Use the following command to start the HSQL server:
Comments