cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: createIfNoSchemaStrategy
Date Sat, 10 Nov 2012 15:29:15 GMT
Hi Emeka,

I had never used a schema with my H2 stuff and you are correct, it
dies when you have it.  :-)

You seem to have found the correct answer, too, from what I could tell
when I updated mine.  Here is what my node XML file ended up looking
like:

<driver project-version="3.0.0.1" class="org.h2.Driver">
	<url value="jdbc:h2:mem:cbe;INIT=CREATE SCHEMA IF NOT EXISTS CBE"/>
	<connectionPool min="1" max="10"/>
	<login/>
</driver>


mrg

On Sat, Nov 10, 2012 at 10:14 AM, emeka okafor <emeka_1978@yahoo.com> wrote:
> From your URL I could infer that I could run arbitrary statement at connection time.
A quick look in the h2 documentation and I can now run my tests with the following url:
> jdbc:h2:/~/test.db;INIT=create schema if not exists test
>
> Thank you again.
>
>
> ________________________________
>  From: Mike Kienenberger <mkienenb@gmail.com>
> To: user@cayenne.apache.org; emeka okafor <emeka_1978@yahoo.com>
> Sent: Saturday, November 10, 2012 3:36 PM
> Subject: Re: createIfNoSchemaStrategy
>
> I haven't used H2 without schemas.
>
> Normally I work using this:
>
> jdbc:h2:~/database.file;SCHEMA_SEARCH_PATH=schema1,schema2,schema3,etc
>
> On Sat, Nov 10, 2012 at 9:12 AM, emeka okafor <emeka_1978@yahoo.com> wrote:
>> Hello again,
>>
>> thank you for the help. I settled with h2database to begin with and now I am getting
this error when I try to run cayenne:
>>
>> Schema "TEST" not found; SQL statement: create blablabla....
>>
>>
>> even though I have set the following:
>>
>> schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"
>>
>>
>> Any idea?
>>
>> ________________________________
>>  From: Michael Gentry <mgentry@masslight.net>
>> To: user@cayenne.apache.org; emeka okafor <emeka_1978@yahoo.com>
>> Sent: Saturday, November 10, 2012 2:26 PM
>> Subject: Re: testing with cayenne
>>
>> Hi Emeka,
>>
>> We've used http://h2database.com/ before to create a real in-memory
>> database to run tests against.  H2 is small and fast and works pretty
>> well, plus by creating your schema/data in-memory only, you don't have
>> to worry about file permissions or cleanup when your tests are done
>> running.
>>
>> mrg
>>
>>
>> On Fri, Nov 9, 2012 at 6:04 PM, emeka okafor <emeka_1978@yahoo.com> wrote:
>>> New cayenne user here. I am trying to use cayenne as the orm for an application
and I was wondering how you guys write your unit test? do you test with a real database or
do you have predefined mock objectcontext and son on to be able to write performant test?
>>> Thank you.

Mime
View raw message