Dependency of DBCPConnectionFactory on ExampleType entity

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Dependency of DBCPConnectionFactory on ExampleType entity

Jacopo Cappellato-4
Hey,

I just discovered that entity-config.xsd already supports the ability to set a validation query:

pool-jdbc-test-stmt

I am going to change the code to use this.

Jacopo

On May 23, 2012, at 6:51 PM, Jacopo Cappellato wrote:

> I just realized that line 150 in DBCPConnectionFactory:
>
> factory.setValidationQuery("select example_type_id from example_type limit 1");
>
> is a dependency on ExampleType entity declared in the "example" component.
>
> This is probably not a big deal but now that we have moved the "example" component to specialpurpose it is more important to have framework code not dependent on it.
>
> What is your preference to fix this? Some options I can think of:
>
> 1) modify the sql to use SequenceValueItem or another entity declared in the same component (or, less ideally, another framework component like "commons")
> 2) add the sql to a properties file to make it configurable (and change it as above); a small advantage with this approach is that a user could set it to null to turn off validation:
> http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/PoolableConnectionFactory.html#setValidationQuery(java.lang.String)
> 3) figure out if we can find a trick and run an SQL command that doesn't require a table
> 4) other ideas?
>
> Jacopo
>
>
>
>

12