Skip to content
Oliver Ferschke edited this page Mar 18, 2016 · 10 revisions

DiscourseDB requires a local database named discoursedb and a user named local. How can I change this?

You can provide a custom configuration by creating a custom.properties file and putting it in the classpath of your project. Details can be found here.

Eclipse cannot find multiple classes that start with Q, such as QUser or QDiscourse.

Q-classes are autogenerated QueryDSL classes. They are generated by a Maven plugin and should be located in the src/generated-sources/java subfolder of the discoursedb-model project. Sometimes, if the entity classes have been updated, the plugin fails to update the Q-classes. In that case, delete the src/generated-sources/java folder and perform a Project>Clean or Maven>Update project. This should re-generate the classes and solve the problem.

Eclipse cannot find getters, setters, constructors or loggers

Getters, setters, constructors and loggers are autogenerated by Project Lombok. Please follow these instructions to make Eclipse Lombok compatible. Outside of eclipse, no additional configuration is necessary.

Eclipse tells me project definitions are out of date

If the project definition has changed in the parent and a module (e.g. after pulling in updated code from GitHub), you might have to update the eclipse projects. Right-click the affected project in the Package explorer and select Maven > Update Project. Select all outdated projects and start the update by clicking "OK".

My code produces an exception mentioning a detached entity.

You are most likely accessing an entity object that you retrieved from DiscourseDB multiple times without wrapping the operations in a transactions. You should create a transactional method and run these operations within a transaction. See any Service class in any discoursedb-io-* module for examples.

I don't want DiscourseDB to update the schema of my existing database. How do I prevent it from creating or updating databases?

DiscourseDB is set up to automatically create or update the configured database. If a database with the given name did not exist on the server, a new DiscourseDB database is initialized. If one already existed, DiscourseDB checks whether the schema fits the data model and revises the schema if it didn't. This is triggered by the configuration property hibernate.hbm2ddl.auto = update. You can change the behavior by overwriting this property in your custom.properties. If you set the value to validate it will check the integrity of your schema but not automatically update it. Other possible values can be found in the hibernate documentation.