Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This page describes my the steps required and issues associated with running AppFuse on PostgreSQL. If you're developing on Windows or OS X, click here for install packages.
Table of Contents
Setup JDBC Driver [#1]The PostgreSQL JDBC version 3 driver is included in AppFuse, so we just need to tell AppFuse to use it, and what the database connection parameters are.Edit your build.properties file to reflect your new database of choice. MySQL settings are the defaults specified in properties.xml. Here is a sample for PostgreSQL: PostgreSQL: database.jar=${postgresql.jar} database.type=postgresql database.name=appfuse database.host=localhost hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect database.driver_class=org.postgresql.Driver database.url=jdbc:${database.type}://${database.host}/${database.name} database.username=test database.password=testYou can use the database.properties.reference file for other database's settings. NOTE: AppFuse cannot create your database for you in PostgreSQL like it can with MySQL. So those configuration settings are not needed. Therefore, the "db-create" target does not create a database when running PostgreSQL. See the PostgreSQL Sample Script[6] for creating a new database in the Command Line Processor. Code/Configuration Tweaks [#2]Using Hibernate's generator-class="native" for id's in PostgreSQL fails. This is likely due to the fact that data is being inserted using DBUnit and the sequences get out of wack. Changing all id's to "increment" (example below) and seems to fix the problem. This worked on all the databases tested (MySQL, PostgreSQL and DB2).
Run JUnit Tests [#3]No changes are needed to make AppFuse properly run the supplied dao tests. Configure Tomcat to talk to PostgreSQL [#4]Since AppFuse 1.3 the database-specific attributes in tomcat-context.xml and hibernate.cfg.xml are replaced at build-time. This means that nothing special is needed to get Tomcat to talk to PostgreSQL. For users with older versions of AppFuse see the note on the DB2 version of this page for more information. Other issues [#5]Turn off Hibernate Batch Processing for PostgreSQL <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop> <!-- turn off batch updated for PostgreSQL to get nicer exception messages --> <prop key="hibernate.jdbc.batch_size">0</prop> </props> </property> This will have an effect on the performance of the database, so consider the tradeoff of having better error messages. Sample CREATE DATABASE script [#6]This is a sample PostgreSQL script to create a user and a database for an AppFuse application.-- create the test user create user test password 'test'; -- create the database create database appfuse owner test; You can find it on the sub-directory metadata/sql, with the name postgresql-create.sql. One example, suppose your project's name is felini: $gilberto@dev/filine: psql -d template1 -U postgres Password: Welcome to psql 8.1.2, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit template1=# \imetadata/sql/postgresql-create.sql DROP DATABASE CREATE USER CREATE DATABASE template1=#
|