Looks like this is the commit that regressed.

https://github.com/jruby/activerecord-jdbc-adapter/commit/ff14f8d3f626450f3f99bf1d2161254724c514c3

Unfortunately a change was made that increased compatibility with
newer versions of Rails but broke Rails 2.x.

I'll commit changes to add back the functionality for Rails 2.x, for
now I suggest going back to 1.2.1 or 1.2.0.

/Nick

On Fri, Feb 17, 2012 at 8:58 AM, Lance Ball <lanceb...@gmail.com> wrote:
> Thanks Charlie
>
> I hope to poke this more today. But a quick data point. The problem exists 
> with activerecord-jdbc-adapter-1.2.2 but not in 1.1.3.
>
> Lance
>
> On Feb 17, 2012, at 8:00 AM, Charles Oliver Nutter wrote:
>
>> This looks promising:
>>
>> http://stackoverflow.com/questions/1915166/how-to-get-the-insert-id-in-jdbc
>>
>> - Charlie
>>
>> On Thu, Feb 16, 2012 at 5:54 PM, Lance Ball <lanceb...@gmail.com> wrote:
>>> FWIW, I've narrowed it down to this code in ActiveRecord::Base#create
>>>
>>>        self.id = connection.insert(statement, "#{self.class.name} Create",
>>>          self.class.primary_key, self.id, self.class.sequence_name)
>>>
>>> The call to insert is always returning 1 - at least in the successful case.
>>>
>>> TBH, I'm not sure if this is jruby, activerecord-jdbc-adapter, or 
>>> jdbc-postgres that's behaving badly.  I've been digging into 
>>> activerecord-jdbc-adapter and friends today to try and figure out what's 
>>> happening in Connection#insert, but wow that was a big can of worms that I 
>>> was unable to fully grok in a single afternoon.
>>>
>>> Lance
>>>
>>> On Feb 16, 2012, at 10:10 AM, Lance Ball wrote:
>>>
>>>> I have run into this issue as well.  I have not yet dug into a fix, but 
>>>> have been able to reproduce the problem with a simple script that uses 
>>>> activerecord 2.3.11 on jruby 1.6.5.
>>>>
>>>> Here is the source:
>>>> https://github.com/lance/pk_sequence_test
>>>>
>>>> Here is the output:
>>>> $ bundle exec pk_sequence_test.rb
>>>> -- create_table(:pk_tests, {:force=>true})
>>>>   -> 0.1440s
>>>>   -> 0 rows
>>>> -- initialize_schema_migrations_table()
>>>>   -> 0.0030s
>>>> -- assume_migrated_upto_version(0, "db/migrate")
>>>>   -> 0.0030s
>>>> #<PkTest id: 1, name: "foo">
>>>> #<PkTest id: 1, name: "bar">
>>>> #<PkTest id: 1, name: "foobar">
>>>> #<PkTest id: 1, name: "barfoo">
>>>>
>>>> Here is my environment.
>>>> $ gem list
>>>>
>>>> *** LOCAL GEMS ***
>>>>
>>>> activerecord (2.3.11)
>>>> activerecord-jdbc-adapter (1.2.2)
>>>> activesupport (2.3.11)
>>>> bundler (1.0.22)
>>>> jdbc-postgres (9.1.901)
>>>> pg (0.13.1)
>>>>
>>>> $ rvm info
>>>>
>>>> jruby-1.6.5@arjdbc:
>>>>
>>>>  system:
>>>>    uname:       "Darwin Neptune.local 11.3.0 Darwin Kernel Version 11.3.0: 
>>>> Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
>>>>    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release 
>>>> (x86_64-apple-darwin11)"
>>>>    zsh:         "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
>>>>
>>>>  rvm:
>>>>    version:      "rvm 1.9.2 by Wayne E. Seguin (wayneeseg...@gmail.com) 
>>>> [https://rvm.beginrescueend.com/]";
>>>>
>>>>  ruby:
>>>>    interpreter:  "jruby"
>>>>    version:      "1.6.5"
>>>>    date:         "2011-10-25"
>>>>    platform:     "darwin-x86_64-java"
>>>>    patchlevel:   "TM"
>>>>    full_version: "jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java 
>>>> HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]"
>>>>
>>>>  homes:
>>>>    gem:          "/Users/lanceball/.rvm/gems/jruby-1.6.5@arjdbc"
>>>>    ruby:         "/Users/lanceball/.rvm/rubies/jruby-1.6.5"
>>>>
>>>>  binaries:
>>>>    ruby:         "/Users/lanceball/.rvm/rubies/jruby-1.6.5/bin/ruby"
>>>>    irb:          "/Users/lanceball/.rvm/rubies/jruby-1.6.5/bin/irb"
>>>>    gem:          "/Users/lanceball/.rvm/rubies/jruby-1.6.5/bin/gem"
>>>>    rake:         "/Users/lanceball/.rvm/rubies/jruby-1.6.5/bin/rake"
>>>>
>>>>  environment:
>>>>    PATH:         
>>>> "/Users/lanceball/.rvm/gems/jruby-1.6.5@arjdbc/bin:/Users/lanceball/.rvm/gems/jruby-1.6.5@global/bin:/Users/lanceball/.rvm/rubies/jruby-1.6.5/bin:/Users/lanceball/.rvm/bin:/Users/lanceball/bin:/Developer/usr/bin:/Users/lanceball/local/node/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/PostgreSQL/9.0/bin:/opt/local/ImageMagick-6.6.9/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/MacGPG2/bin:/usr/local/git/bin"
>>>>    GEM_HOME:     "/Users/lanceball/.rvm/gems/jruby-1.6.5@arjdbc"
>>>>    GEM_PATH:     
>>>> "/Users/lanceball/.rvm/gems/jruby-1.6.5@arjdbc:/Users/lanceball/.rvm/gems/jruby-1.6.5@global"
>>>>    MY_RUBY_HOME: "/Users/lanceball/.rvm/rubies/jruby-1.6.5"
>>>>    IRBRC:        "/Users/lanceball/.rvm/rubies/jruby-1.6.5/.irbrc"
>>>>    RUBYOPT:      ""
>>>>    gemset:       "arjdbc"
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Feb 15, 2012, at 2:26 AM, Charles Oliver Nutter wrote:
>>>>
>>>>> I will echo Nick's suggestion: reproduce in a simple script. If we can
>>>>> narrow it down to a simple schema and script, the fix may be easy to
>>>>> find.
>>>>>
>>>>> My money is on auto-generated ID not propagating back out properly during 
>>>>> #save.
>>>>>
>>>>> Feel free to open an AR-JDBC issue at this point:
>>>>> https://github.com/jruby/activerecord-jdbc-adapter/issues
>>>>>
>>>>> - Charlie
>>>>>
>>>>> On Tue, Feb 14, 2012 at 4:33 PM, Vivek Pandey <vivek.pan...@gmail.com> 
>>>>> wrote:
>>>>>> that might be the case atleast from pure observation. My rubymine does 
>>>>>> not
>>>>>> let me step inside ActiveRecord::Base.save() with jruby rack:( It does 
>>>>>> not
>>>>>> look like anyone on this list has experienced this problem, that tells me
>>>>>> maybe its some other dependencies or something else causing it. This is
>>>>>> pretty basic stuff and should have worked. I will update you with my
>>>>>> findings.
>>>>>>
>>>>>> vivek.
>>>>>>
>>>>>>
>>>>>> On Tue, Feb 14, 2012 at 1:13 PM, Charles Oliver Nutter 
>>>>>> <head...@headius.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Ahh, that's interesting. So perhaps there's something in save that
>>>>>>> should be getting a generated ID and we're not doing that right?
>>>>>>>
>>>>>>> - Charlie
>>>>>>>
>>>>>>> On Tue, Feb 14, 2012 at 2:36 PM, Vivek Pandey <vivek.pan...@gmail.com>
>>>>>>> wrote:
>>>>>>>> Jruby rackup fails the same way, which is the persisted model object id
>>>>>>>> is
>>>>>>>> shown as 1 instead of its actual value. I ran it thru debugger and 
>>>>>>>> right
>>>>>>>> after product.save(false) product.id gives 1 and if I do
>>>>>>>> Product.find_by_name(), it gives me the just persisted object 
>>>>>>>> correctly.
>>>>>>>>
>>>>>>>> vivek.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Feb 14, 2012 at 8:30 AM, Nick Sieger <nicksie...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> How about rackup on JRuby? Works or fails?
>>>>>>>>>
>>>>>>>>> /Nick
>>>>>>>>>
>>>>>>>>> On Tue, Feb 14, 2012 at 9:43 AM, Vivek Pandey <vivek.pan...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>> Sorry, forgot to give my env. Running my env on rails is non-trivial
>>>>>>>>>> at
>>>>>>>>>> present. All I can tell is that when I run rackup with MRI it all
>>>>>>>>>> works
>>>>>>>>>> well
>>>>>>>>>> but the same when warbled and deployed on tomcat, gives me the id of
>>>>>>>>>> 1!
>>>>>>>>>> Something must be silly going on here not sure what.
>>>>>>>>>>
>>>>>>>>>> thanks,
>>>>>>>>>>
>>>>>>>>>> vivek.
>>>>>>>>>>
>>>>>>>>>> JRuby 1.6.5 with JDK 1.6
>>>>>>>>>>
>>>>>>>>>> $ bundle show
>>>>>>>>>>
>>>>>>>>>> * activerecord (2.3.8)
>>>>>>>>>>  * activerecord-activesalesforce-adapter (2.3.6.1 40ab887)
>>>>>>>>>>  * activerecord-jdbc-adapter (1.2.2)
>>>>>>>>>>  * activerecord-jdbcpostgresql-adapter (1.2.2)
>>>>>>>>>>  * activesupport (2.3.8)
>>>>>>>>>>  * arel (2.2.1)
>>>>>>>>>>  * backports (2.3.0)
>>>>>>>>>>  * blankslate (2.1.2.4)
>>>>>>>>>>  * bouncy-castle-java (1.5.0146.1)
>>>>>>>>>>  * builder (3.0.0)
>>>>>>>>>>  * bundler (1.0.21)
>>>>>>>>>>  * eventmachine (0.12.10)
>>>>>>>>>>  * haml (3.1.4)
>>>>>>>>>>  * hashery (1.5.0)
>>>>>>>>>>  * hpricot (0.8.6)
>>>>>>>>>>  * httpclient (2.2.1)
>>>>>>>>>>  * i18n (0.6.0)
>>>>>>>>>>  * jdbc-postgres (9.1.901)
>>>>>>>>>>  * jruby-jars (1.6.6)
>>>>>>>>>>  * jruby-openssl (0.7.5)
>>>>>>>>>>  * jruby-rack (1.0.10)
>>>>>>>>>>  * json (1.4.6)
>>>>>>>>>>  * mail (2.4.1)
>>>>>>>>>>  * mime-types (1.17.2)
>>>>>>>>>>  * net-ldap (0.1.1)
>>>>>>>>>>  * nokogiri (1.5.0)
>>>>>>>>>>  * oauth (0.4.5)
>>>>>>>>>>  * polyglot (0.3.3)
>>>>>>>>>>  * pony (1.4)
>>>>>>>>>>  * rack (1.3.4)
>>>>>>>>>>  * rack-protection (1.2.0)
>>>>>>>>>>  * rack-test (0.6.1)
>>>>>>>>>>  * rake (0.9.2)
>>>>>>>>>>  * rest-client (1.6.0)
>>>>>>>>>>  * rjack-slf4j (1.5.10.0)
>>>>>>>>>>  * ruby-openid (2.1.8)
>>>>>>>>>>  * rubyzip (0.9.6.1)
>>>>>>>>>>  * sinatra (1.3.1)
>>>>>>>>>>  * sinatra-activerecord (0.1.3)
>>>>>>>>>>  * sinatra-contrib (1.3.1)
>>>>>>>>>>  * sinatra-reloader (1.0)
>>>>>>>>>>  * soap4r (1.5.8)
>>>>>>>>>>  * tilt (1.3.3)
>>>>>>>>>>  * treetop (1.4.10)
>>>>>>>>>>  * uuidtools (2.1.1)
>>>>>>>>>>  * warbler (1.3.2)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Feb 14, 2012 at 6:53 AM, Charles Oliver Nutter
>>>>>>>>>> <head...@headius.com>
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi Vivek!
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Feb 14, 2012 at 8:15 AM, Vivek Pandey
>>>>>>>>>>> <vivek.pan...@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I am using JRuby with Sinatra and ActiveRecord as ORM. I have code
>>>>>>>>>>>> such
>>>>>>>>>>>> as
>>>>>>>>>>>> this:
>>>>>>>>>>>>
>>>>>>>>>>>>     ActiveRecord::Base.transaction do
>>>>>>>>>>>>        product.rollback_active_record_state! do
>>>>>>>>>>>>          if(product.save(false))
>>>>>>>>>>>>            logger.debug "Prod ID: #{product.id}"
>>>>>>>>>>>>            yield if block_given?
>>>>>>>>>>>>          end
>>>>>>>>>>>>        end
>>>>>>>>>>>>      end
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> When I execute rackup with MRI 1.8.7p 357, it prints valid Prod
>>>>>>>>>>>> ID.
>>>>>>>>>>>> However
>>>>>>>>>>>> when I deploy the same using jruby-rack/warbler, It always prints
>>>>>>>>>>>> 1
>>>>>>>>>>>> as
>>>>>>>>>>>> product id, however save is successful and persisted correctly in
>>>>>>>>>>>> the
>>>>>>>>>>>> DB.
>>>>>>>>>>>> Its just that I get invalid product id, which is always 1. Anyone
>>>>>>>>>>>> knows
>>>>>>>>>>>> what
>>>>>>>>>>>> might be going on here?
>>>>>>>>>>>
>>>>>>>>>>> I doubt jruby-rack has anything to do with it. Can you reproduce
>>>>>>>>>>> with
>>>>>>>>>>> "rails server"? What versions of everything?
>>>>>>>>>>>
>>>>>>>>>>> - Charlie
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe from this list, please visit:
>>>>>>>>>>>
>>>>>>>>>>>   http://xircles.codehaus.org/manage_email
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe from this list, please visit:
>>>>>>>>>
>>>>>>>>>   http://xircles.codehaus.org/manage_email
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe from this list, please visit:
>>>>>>>
>>>>>>>   http://xircles.codehaus.org/manage_email
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>   http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to