MonthAugust 2014

Migrating an Existing SQLite3 Database to Grails

I’m started a project using Grails, and I wanted a way to get Grails to generate the Domain classes from an existing SQLite database.  The tool I found to do this was the Grails Database Reverse Engineering Plugin.  This takes an existing SQLite database and gives a groovy Domain class file for each database table that exists.

Settings in BuildConfig.groovy

In the plugins section, add the line

runtime ':db-reverse-engineer:0.5'

Settings in Config.groovy

Add this configuration option (in the global scope) and replace the package name with whatever package name you want.

grails.plugin.reveng.packageName = 'com.somepackagename'

Settings in DataSource.groovy

Under environments -> development, set the following:

dataSource {
     dbCreate = ""
     url = "jdbc:sqlite:/path/to/database/file"
     driverClassName = "org.sqlite.JDBC"

Get the SQLite Dialect

Download HibernateSQLite_with_jar.rar and then extract from the src/main/java/dialect directory to your applications hibernate directory (/grails-app/conf/hibernate). Also:

  1. Change the package name to hibernate
  2. Add import for org.hibernate.type.StringType
  3. Add import for org.hibernate.type.IntegerType
  4. Change all instances of Hibernate.STRING to StringType.INSTANCE
  5. Change all instances of Hibernate.INTEGER to IntegerType.INSTANCE

Add the SQLite JDBC Library to the Project

The SQLite JDBC Library can be downloaded here: and then place it in the “lib” folder of the project

Add jta-1.1.jar to the Project

This library came with the Grails installation.  Place it in the “lib” folder of the project.

Running the Plugin

Calling the following will generate the files:



I now have one groovy Domain class for each table in the database in my Grails project!


The unique constraints that got written into my Domain classes were wrong.  I had to fix them.  Initially, the unique identifier wrote the name of the database column, but instead that should be changed to the variable name that the Domain class called it.

Also, the hasMany and belongTo relationships are not set by the plugin (at least I did not configure it), although there should be a way to configure it with the plugin.

Making Eclipse More Like Visual Studio

I’m very used to using Visual Studio for C++ and what not, but when I write Java on Eclipse, I’m not quite used to the interface, so I decided to make Eclipse more like Visual Studio.

Color Theme, Whitespace, and Intellisense (Code Completion)

I pretty much followed this guide:

For the whitespace section, the download link at the above site was broken, so I got the whitespace settings from here instead:


This guide:, Chris’s answer (not the chosen answer)


I solved this by not using the Eclipse Debug Perspective and just moving the debugger windows like I would in Visual Studio.  The other windows can be moved around within Eclipse to be more like Visual Studio.

Setting Up Trac with Visual SVN Server

Bug trackers are an important part of developing software as it allows teams to manage bugs, features, planning etc.  There are a lot to choose from out there, but out of curiosity I decided to set up my own.  I chose to use Trac for this purpose.  Since I already use Visual SVN Server, I was able to set up Trac with Visual SVN.  All instructions in this post use Windows.


I pretty much used the instructions here:  I didn’t do step 8 written in the instructions, and it still worked for me.  However, what’s not setup is the Trac administrator account.  After the setup, I was able to access the Trac webapp and was also able to view the SVN logs, revisions, etc.  I initially got a message about “no changesets”, but after a commit to the repo, everything showed up on the webapp.

Setting up the admin account

While the above instructions allow you to login to Trac using the existing SVN credentials, that user is not considered an admin user.  All I had to do was run this command:

trac-admin /path/to/projenv permission add bob TRAC_ADMIN

After restarting the server, the admin tab was available in Trac.  Now Trac is available for use for bug tracking with an existing SVN repo!

Road Trip to Seattle and Portland

Since I have a friend living down in Seattle, our group of friends tends to visit him quite a bit down there.  Every time we go down there, we do something different.  This time, we all traveled together down to Portland for the BC Day long weekend.  But first, we celebrated two birthdays and spent the Friday night in Seattle drinking and playing Goat Simulator. The next day, we drove down to Portland and went on a Segway tour around town. We started off with a quick 5-minute tutorial and some hands-on training and off we went! Who knew riding a Segway would be so fun!

Along the way, we passed by some iconic Portland scenery, such one of the many bridges in the city.

As an engineer, naturally I found this LEED Platinum certified building to be quite interesting. Despite having an entire roof filled with solar panels, it only provides 3% of the building’s electrical energy.

Our tour guide said that many people in Portland take part in what’s known as a “Zoobomb”, where one takes a bike (usually a children’s bike) and rides as fast as he/she can down a hill. This pile of children’s bicycles represents this popular activity.

And of course, the popular phrase…

Of course, when in Portland, I had to try some local brews. As always, I like the wheat beers best, and not the IPA’s, amber ales, or anything else.

Link to more photos: here

© 2017 Henry Poon's Blog

Theme by Anders NorénUp ↑