diff --git a/lib/arjdbc/db2/adapter.rb b/lib/arjdbc/db2/adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/arjdbc/db2/adapter.rb
+++ b/lib/arjdbc/db2/adapter.rb
@@ -48,6 +48,19 @@ module ArJdbc
       # TODO: Explain this!
     end
 
+    def prefetch_primary_key?(table_name = nil)
+      # TRUE if the table has no identity column
+      names = table_name.upcase.split(".")
+      sql = "SELECT 1 FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y' "
+      sql += "AND TABSCHEMA = '#{names.first}' " if names.size == 2
+      sql += "AND TABNAME = '#{names.last}'"
+      select_one(sql).nil?
+    end
+
+    def next_sequence_value(sequence_name)
+      select_value("select next value for #{sequence_name} from sysibm.sysdummy1")
+    end
+
     module Column
       def type_cast(value)
         return nil if value.nil? || value =~ /^\s*null\s*$/i
Fetch a sequence value manually for tables with no identity columns

This is to support legacy tables for which the sequence needs to be
manually specified in ActiveRecord