6

I have a database that I'm running several applications from. I like to separate the tables by creating a schema for each application. For my newest application I'm using FluentNHibernate. Seems like I have most of the plumbing correct but when I try to query one of my tables it can not find my table. I ran query analyzer and saw the schema was not included in the query.

I simply do not know what to put on my class (entity or mapper) so NHibernate knows which schema the class belongs to. Where and what do I place inside my classes to link them to a schema?

I've used Castle ActiveRecord in the past and it had an attribute property similar to this:

[ActiveRecord(schema=sports)]

Thanks for your help.

1
  • Can you tell me, did you have the database schemas already created, or NHibernate created them for you? I am having the same problem as yours, but I expected NHibernate to take care of schema creation which does not happen. If I manually create the schemas the queries work though. Commented Mar 17, 2012 at 10:48

1 Answer 1

5

After reading more, the answer can be found on the Fluent NHibernate's FAQ portion of the website.

http://wiki.fluentnhibernate.org/Mapping_a_collection_that_uses_a_private_backing_field

public class PersonMap : ClassMap<Person>
{
  public PersonMap()
  {
    Schema("alternativeSchema");
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.