| At line 5 removed 2 lines. |
| __January 16, 2004 UPDATE:__ I greatly simplified this process in AppFuse and altered this HowTo accordingly. This reflects the latest code in CVS and updates that will be in 1.3. |
|
| At line 29 changed 1 line. |
| 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 DB2, followed by one for PostgreSQL: |
| 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 DB2: |
| At line 41 changed 1 line. |
| hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect |
| hibernate.dialect=org.hibernate.dialect.DB2Dialect |
| At line 48 removed 18 lines. |
| __PostgreSQL:___ |
| {{{ |
| database.jar=${postgresql.jar} |
| database.type=postgresql |
| database.name=appfuse |
| database.host=localhost |
| #database URL for creating other databases |
| database.admin.url=jdbc:${database.type}://${database.host}/template1 |
| database.admin.username=postgres |
| database.admin.password=postgres |
|
| hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect |
| database.driver_class=org.postgresql.Driver |
| database.url=jdbc:${database.type}://${database.host}/${database.name} |
| database.username=postgres |
| database.password=postgres |
| }}} |
|
| At line 68 changed 1 line. |
| I was unable to create databases ''on-the-fly'' (using JDBC) on PostgresSQL (transaction error) or on DB2. Therefore, I changed the "db-create" target to only attempt to do this for MySQL. If you're not using MySQL, you don't need to specify the database.admin.* properties since they won't be used. See the DB2 Sample Script[#6] for creating a new database in the ''Command Line Processor''. |
| I was unable to create databases ''on-the-fly'' (using JDBC) on PostgresSQL (transaction error) or on DB2. Therefore, I changed the "db-create" target to only attempt to do this for MySQL. If you're not using MySQL, you don't need to specify the database.admin.* properties since they won't be used. See the DB2 Sample Script[6] for creating a new database in the ''Command Line Processor''. |
| At line 79 added 16 lines. |
| __NOTE:__ After trying AppFuse on PostgreSQL, I discovered that using Hibernate's ''generator-class="native"'' for my id's failed. This is likely due to the fact that I'm inserting data (using DBUnit) and the sequences get out of wack. I changed all id's to "increment" (example below) and it fixed the problem. This worked on all the databases I tested (MySQL, PostgreSQL and DB2). |
|
| [{Java2HtmlPlugin |
|
| /** |
| * Returns the id. |
| * @return String |
| * |
| * @hibernate.id column="id" |
| * generator-class="increment" unsaved-value="null" |
| */ |
| public Long getId() { |
| return id; |
| } |
| }] |
|
| At line 136 added 1 line. |
| <div style="color: #666"> |
| At line 144 changed 1 line. |
| test -> admin (usernames and passwords) |
| test -> db2admin (usernames and passwords) |
| At line 156 changed 1 line. |
| {{{ [java] at org.appfuse.persistence.UserDAOHibernate.getUsers(UserDAOHibernate.java:89) |
| {{{ [java] at org.appfuse.dao.UserDAOHibernate.getUsers(UserDAOHibernate.java:89) |
| At line 166 added 1 line. |
| </div> |
| At line 196 changed 1 line. |
| After [searching on Google|http://tinyurl.com/ys3zm] it appears this is caused by some columns I have that are length="2000". I created a new Buffer Pool with Page Size = 8, and added a new Table Space that used this Buffer Pool. Running "ant db-init" worked after doing this. I suppose if I had a database creation script, this would not be a problem because the Buffer Pool and Table Space sizes would be set properly. |
| After [searching on Google|http://tinyurl.com/ys3zm] it appears this is caused by some columns I have that are length="2000". I created a new Buffer Pool with Page Size = 8, and added a new Table Space that used this Buffer Pool. Running "ant db-init" worked after doing this. |
| At line 209 removed 2 lines. |
| ;:''I'm sure if I had a proper database creation script, with proper table spaces sizes (page size = 8), this would be much easier.'' |
|