You can use the Inflector in uNhAddIns which have the DB dictionary and implements INamingStrategy. About schema and catalog you shouldn't map it in any class and, instead, you can use the NH's session-factory configuration to define the default schema/catalog.
On Fri, May 7, 2010 at 11:48 AM, Peter Leeter <[email protected]>wrote: > Okay, solved it by myself. > These resources helped me: > http://slagd.com/?p=62 > and used http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx > to serialize my mapping dictionaries into xml instead of using the > app.config. > > Thanks to any who tried to help, > Peter > > > On 7 Mai, 15:12, Peter Leeter <[email protected]> wrote: > > I seem to just have totally mixed up the schema attribute with the > > table attribute of "<class>", sorry about that. > > > > Nevertheless, the problem remains the same, I need to dynamically > > switch the location of where my objects are being persisted into, > > whether it be schema or table.. > > > > Any help is appreciated! > > Peter > > > > On 7 Mai, 15:00, Peter Leeter <[email protected]> wrote: > > > > > > > > > > > > > Sorry, I'll try to be more concrete: > > > > > With schema I mean the schema attribute of "<class>" in the hbm.xml, > > > which is a synonym for the table name. > > > So I see, "customerdb" was a wrong name, should be "customertable". > > > > > I want to be able to persist into another table than it was originally > > > defined in the hbm.xml mapping file. > > > > > For e.g.: Instead of using "customertable", which is defined in the > > > mapping xml, I want to switch that to "customertable_2" (creative, I > > > know), but after the whole project has been compiled. > > > > > This change should be possible for example via the nhibernate > > > configuration file (using query.substitutions as parameter does not > > > seem to work here), or via command line parameter where I would have > > > to extend my program to handle that parameter and then change the > > > schema name programatically, again without having to change the > > > mapping xmls (this is where I thought Interceptors could come in > > > handy?). > > > > > I'm trying to avoid having to set up a second database, just to be > > > able to use the once defined schema (table) names twice - so different > > > configurations of my program should be able to run on the same > > > database. > > > > > Regards, > > > Peter > > > > > On 7 Mai, 14:45, Fabio Maulo <[email protected]> wrote: > > > > > > For example: what mean "different schema" ? > > > > only different schema-name ? > > > > only different tables name ? > > > > different schema-name, different catalog-name, different table-name, > > > > different columns names, different columns specifications, different > > > > tables/columns at all ? > > > > > > On Fri, May 7, 2010 at 9:40 AM, Fabio Maulo <[email protected]> > wrote: > > > > > Please try to explain the problem 'A' instead the problem ('B') you > have > > > > > found trying to resolve the problem 'A' > > > > > > > On Fri, May 7, 2010 at 9:23 AM, Peter Leeter < > [email protected]>wrote: > > > > > > >> Hi there, > > > > > > >> I have another question today: > > > > > > >> In the hbm.xml-descriptor files of my project I use the schema- > > > > >> attribute for each model. > > > > > > >> I got the requirement today that I have to be able to change the > > > > >> schemata for different database configurations. > > > > > > >> Example: I my project compiled with an hbm.xml which has: > > > > >> <class name="Person" table="persons" schema="customerdb"> > > > > > > >> Now I want to be able to change customerdb to another schema > without > > > > >> having to change the hbm.xml - file. > > > > > > >> I think I have to implement something like a replace logic for > that > > > > >> attribute, which can be changed for e.g. at startup via a command > line > > > > >> parameter. > > > > > > >> Does somebody has an idea how I can achieve this? Are interceptors > a > > > > >> way? > > > > > > >> Thanks in advance again for any help! > > > > >> Peter > > > > > > >> -- > > > > >> 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > > >> . > > > > >> For more options, visit this group at > > > > >>http://groups.google.com/group/nhusers?hl=en. > > > > > > > -- > > > > > Fabio Maulo > > > > > > -- > > > > Fabio Maulo > > > > > > -- > > > > 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]<nhusers%[email protected]> > . > > > > For more options, visit this group athttp:// > groups.google.com/group/nhusers?hl=en. > > > > > -- > > > 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]<nhusers%[email protected]> > . > > > For more options, visit this group athttp:// > groups.google.com/group/nhusers?hl=en. > > > > -- > > 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]<nhusers%[email protected]> > . > > For more options, visit this group athttp:// > groups.google.com/group/nhusers?hl=en. > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- 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.
