[hibernate-dev] Wrong JdbcServicesImpl configuration with problematic connection

Dmitry Geraskov dgeraskov at exadel.com
Wed Jun 8 07:07:28 EDT 2011


Thanks to Hardy I was able to run tests from hibernate git repository.

Due to changes since Aplha3 my patch didn't fix the problem. The change 
is about how

serviceRegistry.getService( ConnectionProvider.class )

works - earlier service#configure was not called on this call and there 
was no attempt to load Driver class.

Here is a new patch https://github.com/hibernate/hibernate-core/pull/105
It fixes JDBCServices creation problem and some hibernate metadata is 
acceptable now even if connection can't be established.

But patch doesn't make SchemaExport to work,
as it indirectly calls driver class loading due to the mentioned change.

Also it breaks org.hibernate.test.annotations.SecuredBindingTest which 
expects the fail in JDBCServices constructor.


Dmitry Geraskov

08/06/2011 10:24, Dmitry Geraskov wrote:
> Here is the link to the request:
>
> https://github.com/hibernate/hibernate-core/pull/103
>
> 08/06/2011 9:56, Dmitry Geraskov wrote:
>> Done,
>> please check my pull request.
>>
>> 06/06/2011 15:15, Steve Ebersole wrote:
>>> Then please create a test case that illustrates this problematic
>>> behavior and ideally create a pull request fixing said behavior
>>>
>>> On Jun 6, 2011 5:01 AM, "Dmitry Geraskov"<dgeraskov at exadel.com
>>> <mailto:dgeraskov at exadel.com>>  wrote:
>>>> Hey, guys,
>>>>
>>>> I decided to write to this list to force this mistake to be fixed in
>>> Beta1.
>>>> There is a widely used class JdbcServicesImpl in hibernate4.
>>>> In the configure(Map configValues) it gets Connection object and does
>>>> the configuration. But what if the connection can't be established? It
>>>> do some steps in case of SQLException. But there are could be other
>>>> reasons of connection problem. For example missing
>>>> Driver(ClassNotFoundException), but this exception isn't handled. 
>>>> Why I
>>>> think it should be handled here?
>>>>
>>>> Look at SchemaExport. It has an option "export" to database. And in
>>> case
>>>> this option is set to false we don't need the connection and Driver to
>>>> make it generate schema script successfully. But we still need some
>>>> configuration data from JdbcServices. And actually in hibernate 3 it
>>>> works nice without db connection. I guess it also would work in
>>>> hibernate4 too, but only if connection can't be established because of
>>>> SQLException, but not any other problem.
>>>>
>>>> Dmitry Geraskov
>>>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list