No typecasting for model attributes with Oracle on latest JRuby / activerecord-jdbc-adapter

Has anyone else encountered this bug?

I recently upgraded from Jruby 1.1.4 with activerecord-jdbc-adapter 0.9
to the latest version of both, and I now find that when I find an
instance of a model from the database all the attributes come back as
type string rather than the correct type appropriate to the column in
the database.

I described the problem to nicksieger but he said he didn’t have time to
look at it, so suggested that I ask if anyone on the mailing list had
encountered this problem.

This is what happens:

e = Entry.find(‘1atp’)
=> #
e.attributes
=> {“deposit_site”=>nil, “descriptor”=>“CAMP-DEPENDENT PROTEIN KINASE
(E.C.2.7.1.37) (C/APK) (CATALYTIC SUBUNIT) COMPLEX WITH THE PEPTIDE
INHIBITOR PKI(5-24) AND MNATP (A TERNARY COMPLEX OF CAPK)”,
“first_rev_date”=>“1993-04-15”, “id”=>“1atp”,
“keywords”=>“TRANSFERASE(PHOSPHOTRANSFERASE)”, “major_version”=>“3”,
“method”=>“x-ray diffraction”, “method_class”=>“x-ray”,
“minor_version”=>“2”, “number_boundmols”=>“3”, “number_polymers”=>“2”,
“number_residues”=>“373”, “pdb_rev_date”=>“2009-02-24”,
“pdb_rev_date_original”=>“1993-01-08”, “process_site”=>nil,
“r_factor”=>“.177”, “r_factor_free”=>nil, “resolution”=>“2.2”,
“revision_date”=>“2008-03-03”, “status_code”=>“REL”, “title”=>“2.2
angstrom refined crystal structure of the catalytic subunit of
cAMP-dependent protein kinase complexed with MNATP and a peptide
inhibitor”}

Whereas it used to be like this:

e = Entry.find(‘1atp’)
=> #<Entry id: “1atp”, method: “x-ray diffraction”, method_class:
“x-ray”, resolution: 2.2, r_factor: 0.177, r_factor_free: nil,
pdb_rev_date_original: “1993-01-08”, first_rev_date: “1993-04-15”,
pdb_rev_date: “2009-02-24”, major_version: 3, minor_version: 2,
revision_date: “2008-03-03”, status_code: “REL”, deposit_site: nil,
process_site: nil, keywords: “TRANSFERASE(PHOSPHOTRANSFERASE)”,
descriptor: “CAMP-DEPENDENT PROTEIN KINASE (E.C.2.7.1.37) (C/APK…”,
title: “2.2 angstrom refined crystal structure of the catal…”,
number_residues: 373, number_polymers: 2, number_boundmols: 3>

(more details @ http://kenai.com/jira/browse/ACTIVERECORD_JDBC-136)

As you might imagine, everything is horribly broken now the only data
type that comes back is string.

I’m wondering if it’s something to do with activerecord-jdbc-adapter not
handling synonyms correctly, as the ‘table’ the model corresponds to is
actually a synonym to a table. If I do Entry.columns I get [] back
rather than the big bunch of stuff I used to get on Jruby 1.1.4.

Anyone got any ideas?

Thanks,
-Rob

“98.5% of DNA is considered to be junk DNA with no known purpose. Maybe
it’s XML tags.”

On Tue, Oct 19, 2010 at 11:31 AM, Robert S. [email protected]
wrote:

I recently upgraded from Jruby 1.1.4 with activerecord-jdbc-adapter 0.9

Wow, pretty big jump :slight_smile:

In any case, I haven’t seen this particular problem, but I strongly
recommend using the activerecord-oracle_enhanced-adapter gem
from Raimonds Simanovskis if you’re using an Oracle DB.

FWIW,

Hassan S. ------------------------ [email protected]
twitter: @hassan

In any case, I haven’t seen this particular problem, but I strongly
recommend using the activerecord-oracle_enhanced-adapter gem
from Raimonds Simanovskis if you’re using an Oracle DB.
Yeah, I tried using that. It appears to be massively slower. Page
render times went from about 3s to 16s :-S

-Rob


“98.5% of DNA is considered to be junk DNA with no known purpose. Maybe
it’s XML tags.”

On Tue, Oct 19, 2010 at 2:23 PM, Robert S. [email protected]
wrote:

In any case, I haven’t seen this particular problem, but I strongly
recommend using the activerecord-oracle_enhanced-adapter gem
from Raimonds Simanovskis if you’re using an Oracle DB.
Yeah, I tried using that. It appears to be massively slower. Page render times
went from about 3s to 16s :-S

Wow, we haven’t seen anything remotely like that. You might want to
investigate further, using something like newrelic.

We have certainly had fewer weird (as in, works great in development
with MySQL, falls on ass when staged with Oracle) db-related problems
since switching.

YMMV!

Hassan S. ------------------------ [email protected]
twitter: @hassan