Bugs item #16789, was opened at 2008-01-03 14:51
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=16789&group_id=2014
Category: AR-JDBC
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: activerecord-jdbc-adapter-0.7 oracle issue
Initial Comment:
upgrading from activerecord-jdbc-adapter-0.6 to 0.7 has created the following
issue under oracle 10g when trying to insert a simple record into a table :
NFO | jvm 1 | 2008/01/03 13:39:02 | 13:39:01.924 INFO rails.sonar - Migrating
to PopulateDatabase (3)
INFO | jvm 1 | 2008/01/03 13:39:02 | == PopulateDatabase: migrating
================================================
INFO | jvm 1 | 2008/01/03 13:39:03 | 13:39:03.252 ERROR rails.sonar -
INFO | jvm 1 | 2008/01/03 13:39:03 |
INFO | jvm 1 | 2008/01/03 13:39:03 | ActiveRecord::StatementInvalid
(ActiveRecord::ActiveRecordError: Invalid column index: INSERT INTO metrics
(name, description, direction, value_type) VALUES('cobertura_line_rate', 'Line
Rate Coverage', 1, 6)):
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/WEB-INF/gems/gems/activerecord-1.15.6/lib/active_record/transactions.rb:101:in
`transaction'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/WEB-INF/gems/gems/activerecord-1.15.6/lib/active_record/transactions.rb:121:in
`transaction'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/WEB-INF/gems/gems/activerecord-1.15.6/lib/active_record/transactions.rb:129:in
`save_with_transactions'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/WEB-INF/gems/gems/activerecord-1.15.6/lib/active_record/base.rb:451:in
`create'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/app/controllers/../../db/migrate/003_populate_database.rb:631:in
`insert_metric'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/app/controllers/../../db/migrate/003_populate_database.rb:553:in
`insert_metrics'
INFO | jvm 1 | 2008/01/03 13:39:03 |
E:/server/sonar-dev/lib/sonar-web/app/controllers/../../db/migrate/003_populate_database.rb:22:in
`up'
everything worked fine with the 0.6 release.
AR code creating the table :
create_table :metrics do |t|
t.column :name, :string, :null => false, :limit => 64
t.column :value_type, :integer, :null => false
t.column :description, :string, :null => true
t.column :direction, :integer, :null => false, :default => 0
end
AR call to insert the record :
Metric.create(:name => name,
:description => description,
:value_type => value_type,
:direction => direction)
The oracle sequence is correctly created (checked on the oracle server)
----------------------------------------------------------------------
Comment By: Mike Heininger (heininger)
Date: 2008-01-05 21:11
Message:
I can confirm this issue too.
activerecord-jdbc-adapter 0.6 works
activerecord-jdbc-adapter 0.7 does not work
Both versions fetch the id sequence but version 0.7 does not include the id in
the sql insert.
----------------------------------------------------------------------
Comment By: Rob Christie (rwc9u)
Date: 2008-01-04 21:38
Message:
I upgraded from rails 1.2.4 to rails 2.0 and from activerecord-jdbc-adapter 0.5
to 0.7 and I am seeing the same behavior. I added the following to my
environment.rb as a quick fix. This forces the prefetch of the sequence on the
rails side.
if RUBY_PLATFORM =~ /java/
# the following is a hack to fix inserts for
# activerecord-jdbc-adapter 0.7
module ::JdbcSpec
module Oracle
def prefetch_primary_key?(table_name = nil)
true
end
def next_sequence_value(sequence_name)
select_one("select #{sequence_name}.nextval id from dual")['id'].to_i
end
end
end
end
----------------------------------------------------------------------
Comment By: Nick Sieger (nicksieger)
Date: 2008-01-04 05:29
Message:
Sorry about the regression. Can you try to work up a small testcase, attach it
to JRuby's JIRA at http://jira.codehaus.org/browse/JRUBY, and send an email to
the mailing list?
I myself don't have access to Oracle, but hopefully someone else who does can
confirm the behavior.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=16789&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel