ComboPooledDataSource causes Hibernate 3 to reject JDBC < 4 drivers

Bug #590844 reported by Stephane Epardaud
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
New
Undecided
Guillaume Bort

Bug Description

When using Play 1.1 nighly r906 with a legacy DB driver (JDBC 3), Hibernate crashes when setting up the configuration with errors like the following:

Internal Server Error (500) for request GET /

Oops: AbstractMethodError
An unexpected error occured caused by exception AbstractMethodError: solid.jdbc.SolidDatabaseMetaData.getJDBCMajorVersion()I

play.exceptions.UnexpectedException: Unexpected Error
        at play.Invoker$Invocation.onException(Invoker.java:142)
        at play.Invoker$Invocation.run(Invoker.java:182)
        at Invocation.HTTP Request(Play!)
Caused by: java.lang.AbstractMethodError: solid.jdbc.SolidDatabaseMetaData.getJDBCMajorVersion()I
        at com.mchange.v2.c3p0.impl.NewProxyDatabaseMetaData.getJDBCMajorVersion(NewProxyDatabaseMetaData.java:3726)
        at org.hibernate.engine.jdbc.JdbcSupportLoader.useContextualLobCreation(JdbcSupportLoader.java:78)
        at org.hibernate.engine.jdbc.JdbcSupportLoader.loadJdbcSupport(JdbcSupportLoader.java:52)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:121)
        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2163)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:883)
        at play.db.jpa.JPAPlugin.onApplicationStart(JPAPlugin.java:173)
        at play.Play.start(Play.java:381)
        at play.Play.detectChanges(Play.java:479)
        at play.Invoker$Invocation.init(Invoker.java:98)
        ... 1 more

By looking at the Hibernate code, it seems they handle NoSuchMethodException when accessing JDBC4 features, but because Play is using com.mchange.v2.c3p0.ComboPooledDataSource, we end up with a proxy in the middle which throws AbstractMethodError instead, thus confusing Hibernate. I'm not sure if this is a Play, Hibernate or c3p0 bug, but it prevents us from using Play, with versions of Hibernate that work in other frameworks (Seam, without that c3p0 probably).

Changed in play:
assignee: nobody → Guillaume Bort (guillaume-bort)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.