First, you'll add a bunch of values in 1-2 hashmaps. Then you refactor.
Then you figure out that very often, these hashmaps are rather similar.
Then you notice that minimal transactionality is nice. And perhaps locking.
And suddenly, you have implemented a full scale RDBMS built on hashmaps
that can be queried using a DSL that looks like SQL... Why go through all
that hassle? :)

The nice thing about H2 is that in principle, you could just keep a copy of
your .db file somewhere and restore that at the end of a test that includes
writing...

Cheers,
Lukas

2016-07-01 15:09 GMT+02:00 Jacob G <[email protected]>:

> Thanks. I'll take a look at it, particularly to evaluate in-process mode,
> performance, and complexity of configuration, schema setup and teardown
> between each unit test method. The nice thing about hash tables is there is
> no schema setup or teardown.
>
> On Friday, July 1, 2016 at 8:04:37 AM UTC-4, Lukas Eder wrote:
>>
>> Yes, that exists, and it has a name! H2 in-memory database. :) (or HSQLDB
>> or Derby)
>>
>> Hope this helps.
>> Lukas
>>
>> 2016-07-01 13:46 GMT+02:00 Jacob G <[email protected]>:
>>
>>> For unit testing, I'd like to be able to use in-memory hash tables for
>>> data rather than a database. Rather than re-implement memory-based DAO
>>> classes for every JOOQ-based DAO class, I'd rather have JOOQ execute itself
>>> on hash tables. Conceptually, it seems very doable since Jooq's powerful
>>> metadata model lends itself to being rendered and executed in alternative
>>> ways to sql.
>>>
>>> Has anyone thought about this, or even worked on or implemented such a
>>> solution?
>>>
>>> If I were to go about it, what approach would you suggest, and are there
>>> existing hooks I can use to redirect Jooq to a different hash table
>>> implementation. I see that there is a hook for connections once sql is
>>> rendered, but I'd like to hook in before that, while the query is still an
>>> object. Is that what AbstractDelegatingQuery is for? Any other concerns?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jOOQ User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to