Issue with DatabaseTestFixtureBase + SQLite + schemas

25 vues
Accéder directement au premier message non lu

Charlie M

non lue,
21 avr. 2009, 21:57:5021/04/2009
à 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

non lue,
22 avr. 2009, 01:23:2622/04/2009
à rhino-t...@googlegroups.com
In the test, change the mapping to remove the schema.

Charlie M

non lue,
22 avr. 2009, 01:45:3722/04/2009
à 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

non lue,
22 avr. 2009, 01:59:1822/04/2009
à rhino-t...@googlegroups.com
yes
foreach(var classMapping in cfg.ClassMappings)
{
    classMapping.Schema = null;

Charlie M

non lue,
22 avr. 2009, 21:12:0822/04/2009
à 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)
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message