Issue Details (XML | Word | Printable)

Key: HHH-2412
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Steve Ebersole
Reporter: Ahmet A. Akin
Votes: 6
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

Support for JDBC4

Created: 08/Feb/07 06:14 PM   Updated: 30/Nov/09 06:11 AM   Resolved: 26/Oct/09 08:39 PM
Return to search
Issue 2465 of 4808 issue(s)
<< Previous | HHH-2412 | Next >>
Component/s: core
Affects Version/s: 3.2.1, 3.2.2
Fix Version/s: 3.5.0-Beta-2

Time Tracking:
Not Specified

File Attachments: 1. Text File patch_HH2412_Blob_Interface_Types.txt (3 kB)
2. Text File patch_HH2412_ResultSetWrapper.txt (8 kB)

Environment: windows xp, JDK 6
Issue Links:
Cause
 
Duplicate
 
Fix
 
Follow Up
 
Relates
 

Participants: Ahmet A. Akin, Ben Groeneveld, David Driscoll, Gail Badner, Jim Locum, Max Rydahl Andersen, Steve Ebersole and Teva BREDIN


 Description  « Hide

Hibernate code cannot be compiled under JDK 6. Problems and possible solutions:

1- org.hibernate.jdbc.ResultSetWrapper implements ResultSet. But in Java 6, there are big changes in Resultset interface, and maybe 20+ more methods needs to be implemented in the ResultSetWrapper class. i would suggest eliminating this wrapper class once and for all, because it is only used in one method (in ColumnNameCache, getIndexForColumnName method) and i dont think there is a justification for using that wrapper class.

2- org.hibernate.lob.SerializableBlob needs to implement new Blob interface methods:

public void free() throws SQLException;
public InputStream getBinaryStream(long pos, long length) throws SQLException

But, if this class is publicly accesible or used by API's back compatibility issues needs to be checked.

3- Same as number 2, org.hibernate.lob.BlobImpl class needs to implement new Blob methods.

4- org.hibernate.lob.SerializableClob class needs to implent new Clob methods.

5- org.hibernate.lob.ClobImpl , same as 4.

In fact, Java 6 has a lot of JDBC improvements, maybe a java6 special extra package can be created., but that is a whole different issue.



Ahmet A. Akin added a comment - 08/Feb/07 06:32 PM

ResultSetWrapper is also used in Loader.java, and it seems tricky to remove it from there. Bascially, either all those new methods needs to be implemented, or a better way of caching Column names should be found instead of implementing Resultset with a wrapper.


Max Rydahl Andersen added a comment - 09/Feb/07 04:12 AM

ResultSetWrapper is essential for having decent performance on badly implemented drivers like oracle/mssql


Max Rydahl Andersen added a comment - 09/Feb/07 04:13 AM

btw. does it run under JDK 6?


Ahmet A. Akin added a comment - 09/Feb/07 08:08 AM

yes it runs under Java 6. i still think there should be a better way to implement that caching mechanism, but i haven't gave much thought about it for an acceptable solution.


Teva BREDIN added a comment - 19/Feb/09 08:13 AM

I'm looking for informations about compatibility between Hibernate and JDK 6.

Are the troubleshootings mentioned above still valid?

We want to migrate an enterprise application, based on Hibernate, from JDK 1.4.2 to JDK 6, and this issue leads us to ask questions about the feasibility of this migration.

Thank you in advance for your feedbacks.


Ben Groeneveld added a comment - 14/Jul/09 12:07 PM

We've not had much luck running Hibernate (generally 3.2.4.sp1.cp06) under JDK 1.6. The problems can be difficult to detect, so an initial switch might appear to work. We can recreate a number of errors, but pinpointing the exact issue has been difficult - but a switch back to JDK 1.5 always resolves anomalies. We would see this error on one of our systems - after the exception occurred the session factory goes bad and only a restart allows continuation.

(1) SQL resulted in illegal operation, mismatched types, or incorrect cardinality. [SQL0302] Conversion error on host variable or parameter *N.

On another application when we try to insert a record we get:

(2) [SQL0311] Length in a varying-length or LOB host variable not valid.

We're not using LOBs. With JDK 1.5 planned to sunset in October of 2009 we see an urgent need for a 1.6 upgrade.


Steve Ebersole added a comment - 14/Jul/09 04:52 PM

The "difficult to detect" errors generally fall into the category of problems where Hibernate code is relying on iteration of non-ordered collections. This is something that changed in at least the sun 1.6 jdk. Those uses need to be cleaned up to require the properly ordered collections when/where needed.

Anyway, moving to 1.5 is on the roadmap along with correcting these types of "assumption issues" listed above. Adding drop in support for jdbc 4 is also on readmap.

As ever, if something is truly critical to you then feel free to implement the needed changes and submit the diffs here for inclusion "back up stream".


Steve Ebersole added a comment - 20/Jul/09 11:56 AM

Ahmet, better solutions to the ResultSetWrapper are (1) to utilize AOP and pointcuts against the JDBC driver or (2) to use instrucmentation of those JDBC drivers in the cases where the JDBC driver suffers from these performance issues. That's obviously not something Hibernate can provide though.


David Driscoll added a comment - 17/Aug/09 08:02 PM

I also ran into this issue when trying to resolve HHH-3579.
Since the 20 or so new methods are required by java.sql.ResultSet are new, for now
generated them as stubs.

The classes BlobImpl, ClobImpl, SerializableBlob, SerializableClob also have 2 new methods that
needed to be implemented since java.sql.Blob and java.sql.Clob in Java 1.5 were updated. For now these methods
generated them as stubs.

Legacy code won't call these methods since they didn't yet exist and current code base
needs them implemented in order to compile.


Jim Locum added a comment - 19/Aug/09 03:44 PM

FWIW, my system exhibited very similar behavior to Ben's comment above.

The solution for us was upgrading our JDBC driver implementation and Hibernate to the latest versions.

Before:
Hibernate 3.2.6
jt400 6.2

After:
Hibernate 3.3.2
javassist 3.9.0
jt400 6.5.1


Gail Badner added a comment - 19/Aug/09 04:46 PM

Hi Jim,

Thanks for the feedback.

Was it necessary to upgrade Hibernate to get things to work? Would it have worked by just upgrading the JDBC driver?

Thanks,
Gail


Ben Groeneveld added a comment - 24/Aug/09 04:09 PM

Thanks Jim! We have verified that with a jt400 jdbc driver upgrade from version 5.x to 6.x our second issue, described above, has been resolved. We'll try and report back on the more involved first issue at a later date.


Steve Ebersole added a comment - 14/Sep/09 09:29 AM

FYI, for the JDBC4 portion, here is the design discussion -> http://www.jboss.org/community/wiki/Hibernate-JDBC4support

Currently scheduled for 3.6, though considering possibly adding to 3.5 -> http://www.jboss.org/community/wiki/HibernateRoadmap


Steve Ebersole added a comment - 18/Sep/09 01:50 PM

Changed summary in accordance with the fact that the original discussion focuses on JDBC4, which is part of JDK 1.6.


Steve Ebersole added a comment - 15/Oct/09 02:20 PM

This support has been added on trunk. We still need to work out the details of testing in terms of CI, so I am going to leave this open a bit longer.


Steve Ebersole added a comment - 26/Oct/09 08:39 PM

Added unit test using jdbc proxies. CI plans need to be updated to account for running with both.