Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-29 Thread Jacopo Cappellato
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:

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacques Le Roux
From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a trick to be sure to get a record back even if the entity is empty... but if we use an entity that we are sure is

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacopo Cappellato
On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote: From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a trick to be sure to get a record back even if the

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacques Le Roux
From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote: From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacopo Cappellato
On May 24, 2012, at 10:37 AM, Jacques Le Roux wrote: select 1 works on Postgres this is interesting, thanks for testing it. Unfortunately it doesn't seem to work on Derby and I didn't test on other dbs... but if we could find a similar solution that works everywhere it would be great.

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacques Le Roux
SELECT 1 FROM SYSIBM.SYSDUMMY1 works for Derby. If all others work with SELECT 1 we could set a property in entityengine.xml (by DB)With SELECT 1 for all but Derby and SELECT 1 FROM SYSIBM.SYSDUMMY1 for Derby. We could also use the same trick for other DBs if SELECT 1 does not work for them (eg

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacopo Cappellato
Thanks Jacques. However values 1 works in Derby (but not from the Webtools, because of a limitation in the data prep script). Jacopo On May 24, 2012, at 11:33 AM, Jacques Le Roux wrote: SELECT 1 FROM SYSIBM.SYSDUMMY1 works for Derby. If all others work with SELECT 1 we could set a property

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Adam Heath
On 05/24/2012 03:22 AM, Jacopo Cappellato wrote: On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote: From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a trick

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacopo Cappellato
On May 24, 2012, at 5:06 PM, Adam Heath wrote: On 05/24/2012 03:22 AM, Jacopo Cappellato wrote: On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote: From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacopo Cappellato
On May 24, 2012, at 5:06 PM, Adam Heath wrote: select 1 from entity_key_store where key_name = '' limit 1; ouch, I am getting an error on Derby for the limit 1 syntax... since it is currently used in the validation query based on Example I am now wondering if it is actually used at all. I

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacques Le Roux
From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 24, 2012, at 5:06 PM, Adam Heath wrote: On 05/24/2012 03:22 AM, Jacopo Cappellato wrote: On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote: From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 9:25

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Rajbir Saini
How about defining a test sql statement in entityegine.xml which could be specific to DBMS. For example 'select * from dual in oracle and MySQL, Select 1 in PostgreSQL. Idea is to use the DBMS specific SQL and make it configurable in the entityengine.xml so that it can be configured while

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-24 Thread Jacques Le Roux
Hi Raj, Good idea, I had the same, please re-read the thread ;o) Cheers Jacques From: Rajbir Saini rajbsa...@yahoo.com How about defining a test sql statement in entityegine.xml which could be specific to DBMS. For example 'select * from dual in oracle and MySQL, Select 1 in PostgreSQL. Idea

Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Jacopo Cappellato
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

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Adam Heath
On 05/23/2012 11:51 AM, 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

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Jacopo Cappellato
On May 23, 2012, at 6:53 PM, Adam Heath wrote: 1) modify the sql to use SequenceValueItem or another entity declared in the same component (or, less ideally, another framework component like commons) DBCPConnectionFactory is in framework/entity; having it require a

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Adam Heath
On 05/23/2012 12:05 PM, Jacopo Cappellato wrote: DBCPConnectionFactory is in framework/entity; having it require a framework/entity/entitymodel seems the safest approach. I agree; what if we use: select count(testing_type_id) from testing_type where testing_type_id = 'ABC' Actually, no,

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Jacopo Cappellato
On May 23, 2012, at 7:34 PM, Adam Heath wrote: On 05/23/2012 12:05 PM, Jacopo Cappellato wrote: DBCPConnectionFactory is in framework/entity; having it require a framework/entity/entitymodel seems the safest approach. I agree; what if we use: select count(testing_type_id) from

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Jacques Le Roux
From: Jacopo Cappellato jacopo.cappell...@hotwaxmedia.com On May 23, 2012, at 7:34 PM, Adam Heath wrote: On 05/23/2012 12:05 PM, Jacopo Cappellato wrote: DBCPConnectionFactory is in framework/entity; having it require a framework/entity/entitymodel seems the safest approach. I agree;

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Adam Heath
On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a trick to be sure to get a record back even if the entity is empty... but if we use an entity that we are sure is populated we don't have to use it, of course. Of course if we use count(*) we have to use it in an

Re: Dependency of DBCPConnectionFactory on ExampleType entity

2012-05-23 Thread Jacopo Cappellato
On May 23, 2012, at 9:25 PM, Adam Heath wrote: On 05/23/2012 01:13 PM, Jacopo Cappellato wrote: Using count() was simply a trick to be sure to get a record back even if the entity is empty... but if we use an entity that we are sure is populated we don't have to use it, of course. Of