If I raise a regular exception after the save the enclosing transaction
is rolled back. But if the OutOfMemoryError exception occurs the
transaction is committed. Am I missing something obvious?
(Java 1.6.0_03, JRuby 1.3.1, activerecord 2.3.2, active-jdbc-adapter
0.9, Oracle 10g, oracle jdbc driver 9.0.2.0.0)
require ‘rubygems’
gem ‘activerecord-jdbc-adapter’
require ‘active_record’
require ‘yaml’
class Trader < ActiveRecord::Base
end
class Demo
def connect
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(YAML::load_file(‘oome.yml’)['dev
'])
end
def create_trader
ActiveRecord::Base.connection.transaction do
trader = Trader.new
trader.name = ‘Darcy’
trader.save
#force an OutOfMemoryError
a = ‘’
1000000.times do
a << String.new(‘a’*10000)
end
end
end
end
demo = Demo.new
demo.connect
demo.create_trader
This email communication and any files transmitted with it may contain
confidential and or proprietary information and is provided for the use
of the intended recipient only. Any review, retransmission or
dissemination of this information by anyone other than the intended
recipient is prohibited. If you receive this email in error, please
contact the sender and delete this communication and any copies
immediately. Thank you.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email