You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Miłosz Pigłas <mi...@archeocs.com> on 2013/06/08 09:04:11 UTC

Firebird support

Hi,

I'm interested in using Firebird database with cayenne. I read on 
http://cayenne.apache.org/docs/3.0/database-support.html that you need 
testers for this db. I want to help, but as I see there Firebird is not 
supported in 3.x.

So my question is where I should to start? Should I try to "port" 
classes from 2.x branch, which seems, according to javadoc, the last 
one, where support for Fb is avilable?

Regards
Milosz

Re: Firebird support

Posted by Andrus Adamchik <an...@objectstyle.org>.
Committed. Thanks a lot for the adapter.

Andrus

On Jun 15, 2013, at 12:29 PM, Miłosz Pigłas <mi...@archeocs.com> wrote:

> Hi,
> 
> On 06/12/2013 08:47 PM, Andrus Adamchik wrote:
>> 
>> On Jun 12, 2013, at 9:18 PM, Miłosz Pigłas<mi...@archeocs.com>  wrote:
>> 
>>> Test org.apache.cayenne.query.SelectQueryTest#testSelectLongIn(), ends with error because of generated statement size and firebird limitations (http://www.firebirdfaq.org/faq299/). Are such errors aceptable?
>> 
>> For other DBs we used UnitDbAdapter as a means to suppress certain unit tests on some DBs. Although looking at this test, I am not quite sure what it tests :) I'd just remove this particular test actually.
> 
> Actually I consider this test case quite as usefull. Before I run it I hadn't known that I have to split very large IN statements (more than 1500 values) on smaller parts.
> 
> Firebird Adapter is ready: https://issues.apache.org/jira/browse/CAY-1836. Please review it ;).
> 
> Thanks,
> Milosz
> 
> 


Re: Firebird support

Posted by Miłosz Pigłas <mi...@archeocs.com>.
Hi,

On 06/12/2013 08:47 PM, Andrus Adamchik wrote:
>
> On Jun 12, 2013, at 9:18 PM, Miłosz Pigłas<mi...@archeocs.com>  wrote:
>
>> Test org.apache.cayenne.query.SelectQueryTest#testSelectLongIn(), ends with error because of generated statement size and firebird limitations (http://www.firebirdfaq.org/faq299/). Are such errors aceptable?
>
> For other DBs we used UnitDbAdapter as a means to suppress certain unit tests on some DBs. Although looking at this test, I am not quite sure what it tests :) I'd just remove this particular test actually.

Actually I consider this test case quite as usefull. Before I run it I 
hadn't known that I have to split very large IN statements (more than 
1500 values) on smaller parts.

Firebird Adapter is ready: 
https://issues.apache.org/jira/browse/CAY-1836. Please review it ;).

Thanks,
Milosz


Re: Firebird support

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 12, 2013, at 9:18 PM, Miłosz Pigłas <mi...@archeocs.com> wrote:

> thank you for your help. Adapter is almost ready,

Great!

> but there is still one test case: org.apache.cayenne.access.NestedDataContext_DeadlockTest, which fails. Test passes only if checking threads is delayed few second - probably firebird performance is to low.

Yeah, don't worry about this. This test is not adapter-specific. 

> Test org.apache.cayenne.query.SelectQueryTest#testSelectLongIn(), ends with error because of generated statement size and firebird limitations (http://www.firebirdfaq.org/faq299/). Are such errors aceptable?

For other DBs we used UnitDbAdapter as a means to suppress certain unit tests on some DBs. Although looking at this test, I am not quite sure what it tests :) I'd just remove this particular test actually. 

There are cases when *Cayenne* generates IN clauses, e.g. for prefetching or paginated queries. And the max size of IN is controlled by the following property:

http://cayenne.apache.org/docs/3.1/api/org/apache/cayenne/configuration/Constants.html#SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY

But we are not dealing with this here. So yeah, let's remove it.

> Some tests, which tries to delete all records from table where one record has reference to other record in _the same table_ also ends in error. Usually in method setUpAfterInjection(), which prepares database to test.
> Firebird doesn't recognise that all records are deleted and denies breaking foreign key constraint.
> Example of such case is org.apache.cayenne.access.JoinPrefetchTest.
> 
> My question is how to deal with such errors? In this case solution might be removing references before clearing table, but I'm not sure it is good idea to change code of test cases.

I am +1 on doing that if it solves the problem. How we prepare test cases is up to us, and if we come up with a strategy that works with more DBs, I am all for it.

Thanks,
Andrus


Re: Firebird support

Posted by Miłosz Pigłas <mi...@archeocs.com>.
Hi,

On 06/08/2013 05:53 PM, John Huss wrote:
> [..]
>
> On Saturday, June 8, 2013, Andrus Adamchik wrote:
>
> [..]

thank you for your help. Adapter is almost ready, but there is still one 
test case: org.apache.cayenne.access.NestedDataContext_DeadlockTest, 
which fails. Test passes only if checking threads is delayed few second 
- probably firebird performance is to low.

Test org.apache.cayenne.query.SelectQueryTest#testSelectLongIn(), ends 
with error because of generated statement size and firebird limitations 
(http://www.firebirdfaq.org/faq299/). Are such errors aceptable?

Some tests, which tries to delete all records from table where one 
record has reference to other record in _the same table_ also ends in 
error. Usually in method setUpAfterInjection(), which prepares database 
to test.
Firebird doesn't recognise that all records are deleted and denies 
breaking foreign key constraint.
Example of such case is org.apache.cayenne.access.JoinPrefetchTest.

My question is how to deal with such errors? In this case solution might 
be removing references before clearing table, but I'm not sure it is 
good idea to change code of test cases.

Regards
Milosz

Re: Firebird support

Posted by John Huss <jo...@gmail.com>.
I actually have a working firebird adapter at least as of cayenne 3.1.  It
was targeted at older firebird -- version 1.5.  But it should be a good
starting place; it was based off the previous one in cayenne.  We're not
using it anymore.  I can send you a link on Monday.

John

On Saturday, June 8, 2013, Andrus Adamchik wrote:

>
> On Jun 8, 2013, at 10:04 AM, Miłosz Pigłas <milosz@archeocs.com<javascript:;>>
> wrote:
>
> > Hi,
> >
> > I'm interested in using Firebird database with cayenne. I read on
> http://cayenne.apache.org/docs/3.0/database-support.html that you need
> testers for this db. I want to help, but as I see there Firebird is not
> supported in 3.x.
> >
> > So my question is where I should to start? Should I try to "port"
> classes from 2.x branch, which seems, according to javadoc, the last one,
> where support for Fb is avilable?
> >
> > Regards
> > Milosz
>
> Hi Milosz,
>
> Yeah, would be great if you could champion a modern FireBird adapter.
> Quick check of the SVN shows that the last time when Cayenne had a FireBird
> adapter was in 1.2:
>
>
> http://svn.apache.org/repos/asf/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/firebird/
>
> The best approach to resurrect it is to create a placeholder for the
> adapter, and integrate it with Cayenne unit tests engine in the
> "cayenne-jdk1.5-unpublished" module. Then you'll be able to run the test
> suite that will give you an idea of what "non-standard" things Firebird
> expects from a Java app. Then you can port the old adapter code
> piece-by-piece or write any new adapter code as appropriate, with test
> results giving you a picture of what is still missing.
>
> In practical terms this means the following:
>
> 1. Create an empty firebird adapter under org.apache.cayenne.dba.firebird
> package, inheriting from JdbcAdapter (also create FirebirdSniffer)
> 2. Integrate FirebirdAdapter in runtime DI container via ServerModule
> (done via a DB-specific "sniffer" that detects the DB type dynamically)
> 3. Create a "firebird" profile in the topmost pom.xml, similar to other DB
> adapter profiles
> 4. Implement UnitDbAdapter for the Firebird unit test (check
> ServerCaseModule for details).
>
> After that you should be able to run unit tests e.g. as "mvn clean install
> -DcayenneTestConnection=firebird"
>
> Feel free to ask more questions.
>
> Andrus

Re: Firebird support

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 8, 2013, at 10:04 AM, Miłosz Pigłas <mi...@archeocs.com> wrote:

> Hi,
> 
> I'm interested in using Firebird database with cayenne. I read on http://cayenne.apache.org/docs/3.0/database-support.html that you need testers for this db. I want to help, but as I see there Firebird is not supported in 3.x.
> 
> So my question is where I should to start? Should I try to "port" classes from 2.x branch, which seems, according to javadoc, the last one, where support for Fb is avilable?
> 
> Regards
> Milosz

Hi Milosz, 

Yeah, would be great if you could champion a modern FireBird adapter. Quick check of the SVN shows that the last time when Cayenne had a FireBird adapter was in 1.2:

http://svn.apache.org/repos/asf/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/firebird/

The best approach to resurrect it is to create a placeholder for the adapter, and integrate it with Cayenne unit tests engine in the "cayenne-jdk1.5-unpublished" module. Then you'll be able to run the test suite that will give you an idea of what "non-standard" things Firebird expects from a Java app. Then you can port the old adapter code piece-by-piece or write any new adapter code as appropriate, with test results giving you a picture of what is still missing. 

In practical terms this means the following:

1. Create an empty firebird adapter under org.apache.cayenne.dba.firebird package, inheriting from JdbcAdapter (also create FirebirdSniffer)
2. Integrate FirebirdAdapter in runtime DI container via ServerModule (done via a DB-specific "sniffer" that detects the DB type dynamically)
3. Create a "firebird" profile in the topmost pom.xml, similar to other DB adapter profiles
4. Implement UnitDbAdapter for the Firebird unit test (check ServerCaseModule for details).  

After that you should be able to run unit tests e.g. as "mvn clean install -DcayenneTestConnection=firebird"

Feel free to ask more questions.

Andrus