AppFuse 1.8 w/ PostgreSQL and Tapestry06/08/2005 06:59 PM
Had some time to try out AppFuse 1.8.
Here are a few notes for those who use PostgreSQL for their database
instead of MySQL
After you use AppFuse to generate your
application, be sure to add a jUnit login to PostgreSQL named "test/test"
for the unit tests. Alternatively, you can modify the properties.xml
file in your generated application directory to use a valid username/password
(use database.username and database.password).
Before you generate the DDL, create a database in PostgreSQL; this database
name has to match the one you gave when you ran "ant new" to
generate your application.
To generate the DDL for creating the database, you now use "ant db-prepare"
instead of "ant db-prep". You'll have to do this since
you can't use a JDBC connection to create a database in PostgreSQL. As
mentioned in a previous blog entry, the only database that supports creating
a new database via a JDBC connection is MySQL; too bad it's not a "real"
database
One interesting quirk I ran into was that Ant 1.6.5 doesn't seem to expand
the database.url property properly in properties.xml. The result
was that the database.properties that was generated from properties.xml
had a line that looked like:
hibernate.connection.url=jdbc\:postgresql\://localhost/${database.name}
where database.name wasn't substituted in. If I changed
<entry key="hibernate.connection.url" value="${database.url}"/>
to (copy the value of database.url into it yourself):
<entry key="hibernate.connection.url"
value="jdbc:${database.type}://${database.host}/${database.name}..."/>
It would work fine. Now you can take the DDL from the create-tables.sql
file and feed it into PostgreSQL's query tool to generate the database
tables.
Unfortunately, the next thing the bad database.url property breaks is the
dbunit task in the build.xml's db-load task. The proper workaround
is to specify the database.name property in your build.properties file.
Run "ant test-all" to run all the unit tests. Then run
"ant test-reports" to generate an HTML test report in the build\test\reports
subdirectory of your new application.
Now you can try out your application at: http://localhost:8080/mytestapp
(assuming you're using Tomcat) after
you do "ant setup-tomcat" and "ant deploy".
Unfortunately, the Tapestry version still doesn't handle duplicate usernames
gracefully. If you try adding "mraible" or "tomcat"
(the two existing users), it'll say that the username or email address
exists already, but then you can't edit the username; you also get an ugly
exception in the Tomcat log. If you try saving the form again after
changing the email address, it blows up w/ a stale row exception.