Issue with DatabaseTestFixtureBase + SQLite + schemas

26 views
Skip to first unread message

Charlie M

unread,
Apr 21, 2009, 9:57:50 PM4/21/09
to Rhino Tools Dev
Hello,

I'm trying to use the DatabaseTestFixtureBase class teamed with SQLite
to achieve speedy in-memory database unit tests.

I was previously using AR but have since reverted to using NH
directly, a move that has seen me define a schema attribute for my
mapped entities. E.g.:

<hibernate-mapping schema="Foo.dbo">
<class table="Bar">
</class>
</hibernate-mapping>

etc.

However, it turns out that SQLite is not fond of SQL Server's dot
notation. I'm receiving the following error:

Unsuccessful: create table Foo.dbo_Bar
SQLite error unknown database Foo

Are there any possible work-arounds?

Cheers,

Charlie.

Ayende Rahien

unread,
Apr 22, 2009, 1:23:26 AM4/22/09
to rhino-t...@googlegroups.com
In the test, change the mapping to remove the schema.

Charlie M

unread,
Apr 22, 2009, 1:45:37 AM4/22/09
to Rhino Tools Dev
Is there a way to do this programatically using NH?

On Apr 22, 1:23 pm, Ayende Rahien <aye...@ayende.com> wrote:
> In the test, change the mapping to remove the schema.
>

Ayende Rahien

unread,
Apr 22, 2009, 1:59:18 AM4/22/09
to rhino-t...@googlegroups.com
yes
foreach(var classMapping in cfg.ClassMappings)
{
    classMapping.Schema = null;

Charlie M

unread,
Apr 22, 2009, 9:12:08 PM4/22/09
to Rhino Tools Dev
Thanks for your help.

For the record, for your suggestion to work, I had to define the
schema at the class/table level rather than at the default level.
I.e.:

This:

<hibernate-mapping>
<class schema="Foo.dbo" table="Bar">
</class>
</hibernate-mapping>

Instead of:

<hibernate-mapping schema="Foo.dbo">
<class table="Bar">
</class>
</hibernate-mapping>

Unless there are ways of setting the default schema to null
programatically?


On Apr 22, 1:59 pm, Ayende Rahien <aye...@ayende.com> wrote:
> yesforeach(var classMapping in cfg.ClassMappings)
Reply all
Reply to author
Forward
0 new messages