diff --git a/Database/PostgreSQL/ORM/Model.hs b/Database/PostgreSQL/ORM/Model.hs
--- a/Database/PostgreSQL/ORM/Model.hs
+++ b/Database/PostgreSQL/ORM/Model.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE DefaultSignatures #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE FlexibleInstances #-}
@@ -155,7 +156,7 @@
 -- If you wish to store a `Model`'s primary key as a reference in
 -- another 'Model', do not copy the 'DBKey' structure.  Use 'mkDBRef'
 -- to convert the `Model`'s primary key to a foreign key reference.
-data DBKey = DBKey !DBKeyType | NullKey deriving (Data, Typeable)
+data DBKey = DBKey !DBKeyType | NullKey deriving (Data, Typeable, Generic)
 
 instance A.ToJSON DBKey where
   toJSON NullKey = A.Null
@@ -197,7 +198,7 @@
 -- phantom type denoting the flavor of reference ('NormalRef' or
 -- 'UniqueRef').
 newtype GDBRef reftype table = DBRef DBKeyType
-  deriving (Eq, Data, Typeable, Num, Integral, Real, Ord, Enum, Bounded)
+  deriving (Eq, Data, Typeable, Num, Integral, Real, Ord, Enum, Bounded, Generic)
 
 instance A.ToJSON (GDBRef t a) where
   toJSON (DBRef k) = A.toJSON k
@@ -817,7 +818,7 @@
 DEGENERATE((FromField a, FromField b), (a, b))
 DEGENERATE((FromField a, FromField b, FromField c), (a, b, c))
 DEGENERATE((FromField a, FromField b, FromField c, FromField d), (a, b, c, d))
-DEGENERATE((FromField a, FromField b, FromField c, FromField d, FromField e),
+DEGENERATE((FromField a, FromField b, FromField c, FromField d, FromField e), \
            (a, b, c, d, e))
 
 #undef DEGEN_ERR
diff --git a/postgresql-orm.cabal b/postgresql-orm.cabal
--- a/postgresql-orm.cabal
+++ b/postgresql-orm.cabal
@@ -1,5 +1,5 @@
 name: postgresql-orm
-version: 0.3.0
+version: 0.3.1
 cabal-version: >= 1.14
 build-type: Simple
 license: GPL
