- Integrating derby into eclipse:
http://db.apache.org/derby/integrate/plugin_howto.html
Note: In the projects properties you can modify the path, where Derby stores the database files. -
Starting the database network server:
http://db.apache.org/derby/integrate/plugin_help/start_server.html -
Using Squirrel as front end:
http://db.apache.org/derby/integrate/SQuirreL_Derby.html
public static SessionFactory createDerbyFactory() {
AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration();
annotationConfiguration.setProperty("hibernate.connection.driver_class", "org.apache.derby.jdbc.ClientDriver");
annotationConfiguration.setProperty("hibernate.connection.url", "jdbc:derby://localhost:1527/simpletest");
annotationConfiguration.setProperty("hibernate.connection.username", "user");
annotationConfiguration.setProperty("hibernate.connection.password", "user");
annotationConfiguration.setProperty("hibernate.dialect", "org.hibernate.dialect.DerbyDialect");
annotationConfiguration.setProperty("hibernate.show_sql", "true");
annotationConfiguration.setProperty("hibernate.format_sql", "true");
annotationConfiguration.setProperty("hibernate.hbm2ddl.auto", "create-drop");
annotationConfiguration.addAnnotatedClass(Person.class);
return annotationConfiguration.buildSessionFactory();
}
In order to use this setup, you need to create a derby database. How to do this, is described here:
http://db.apache.org/derby/integrate/SQuirreL_Derby.html