I'm not here to debate whether identities or sequences are good or bad. Just to inquire about how you might approach a situation where, for various reasons, you need to have different physical dbms models beneath your mappings. This is just one example.
Fact is, I'm not in a position to change the whole way my existing SQL server application does business at this point. I would like to keep my mapping layer generic, if possible, as I extend it to support other db types. It seems to me that, for the same reasons that the database-object element has dialect-scope, maybe all mapping elements could benefit by supporting a similar mechanism. It'd make the XSD more challenging maybe, but to me at least, well worth it. On Sep 28, 7:06 pm, Jason Meckley <[email protected]> wrote: > use guid, guid.comb or hilo. Not to mention sql identity breaks the > entire UOW concept with NH. You also loose the ability to batch > commands. > > On Sep 28, 6:01 pm, rsr <[email protected]> wrote: > > > Wondering how to approach the following > > > Suppose I want to support both SQL and Oracle, using the same domain > > model, and mapping files. > > Mostly, this works out nicely, and the mapping files are generally > > "dialect neutral". > > But I can see one problem so far, where it isn't quite so, the case of > > id generator types. > > > Consider the following hbm snippet > > > <id name="Col1" type="int" unsaved-value="0"> > > <column name="Col1"/> > > <generator class="native"> > > <param name="sequence">axiom_seq_2</param> > > </generator> > > </id> > > > Here, i have used the native generator class, which gives me > > identities with SQL and sequences with Oracle. I can further control > > the sequence using params, which are only used with Oracle. > > > That kind of works, but there are a couple of problems and, what I > > really want is to be able to use a generator element with > > class="identity" for SQL and with class="seqhilo" and parameters for > > Oracle. > > > Like, if each mapping element had a "dialect" attribute or something > > that would cause the element to be ignored if the current dialect > > doesn't match. Any thought given to that sort of thing ever? > > > Is there some other mapping approach that would let me do this? I'm > > considering adding my own attribute to the XML and then filtering on > > it when I add the resource file. Not ideal, but I don't see a better > > way. > > > Suggestions? > > -- 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.
