That is not a supported scenario.
The schema is just that, the schema.
While you can use this to sort of get what you want, it will break in this
kind of scenarios.
Catalog awareness is a feature that I think we intend to put in 2.1
On Thu, Sep 25, 2008 at 8:41 PM, Brian Meeker <[EMAIL PROTECTED]>wrote:
>
> I am talking about cross database. Both databases are on the same
> instance of SQL Server and I use the same connection string to connect
> to both. Instead of specifying an initial catalog in the connection
> string each entity specifies a schema. Below is an example of what I
> am doing.
>
> [ActiveRecord(Schema="workflow.dbo")]
> public partial class County {
>
> private int _id;
> private string _name;
>
> [PrimaryKey(PrimaryKeyType.Native, Access =
> PropertyAccess.NosetterCamelcaseUnderscore)]
> public int Id {
> get { return this._id; }
> }
>
> [Property("County", Length=50, NotNull=true)]
> public string Name {
> get { return this._name; }
> set { this._name = value; }
> }
> }
>
> [ActiveRecord(Schema="phoenix.dbo")]
> public partial class Property {
>
> private int _id;
> private County _county;
>
> [PrimaryKey(PrimaryKeyType.Native, Access =
> PropertyAccess.NosetterCamelcaseUnderscore)]
> public int Id {
> get { return this._id; }
> }
>
> [BelongsTo("CountyId")]
> public County County {
> get { return this._county; }
> set { this._county = value; }
> }
> }
>
> The script created by SchemaExport in this case gives
>
> alter table phoenix.dbo.Property add constraint FK63646D8599364611
> foreign key (CountyId) references workflow.dbo.County
>
> which is invalid in SQL Server. For the time being we need the two
> separate databases for legacy reasons, but they will be merged
> together at some point in the future as we phase out the old
> application. Is there a better way to go about handling multiple
> databases?
>
> On Sep 25, 11:46 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > 1/ yes, please.
> > 2/ Are you talking about cross database or cross schema?
> >
> > On Thu, Sep 25, 2008 at 5:48 PM, Brian Meeker <[EMAIL PROTECTED]
> >wrote:
> >
> >
> >
> > > Background: On my current project we are using SchemaExport to create
> > > and drop our schema for database dependent tests. We are running one
> > > instance of SQL Server 2005 with two separate databases that make up
> > > our domain model and we use the schema attribute to map entities to
> > > the proper database. Both of these look to be problems in the
> > > MsSql2000Dialect.
> >
> > > Issue 1: The MsSql2000Dialect uses a string of the following form to
> > > drop a table:
> >
> > > "if exists (select * from dbo.sysobjects where id object_id(N'{0}')
> > > and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table {0}"
> >
> > > The use of "dbo.sysobjects" instead of [defaultSchema].sysobjects
> > > causes tables not to be dropped if the table is not in the initial
> > > catalog. I have a fix for this that adds defaultSchema to
> > > GetDropTableString. Should I create an issue in JIRA and submit a
> > > patch?
> >
> > > Issue 2: My other issue relates to cross-database foreign keys. SQL
> > > Server 2005 does not support them but SchemaExport tries to create
> > > them anyways when creating the schema. Should the MsSql2000Dialect not
> > > attempt to create a foreign key in this case? If not, I can create an
> > > issue in JIRA for this to and hopefully work on it soon.
> >
> > > Thanks,
> > > Brian
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---