and @ Decimal: I tried to do it that why, but it didn't accept the int as Id. I've got an Oracle DB and use a Sequence. I'll have a look at it, I'd prefer Int64 as type, too. Thanks for the tip :)
On 30 Sep., 17:50, reflection <[email protected]> wrote: > Well in my program a teststep is a final object... it doesn't actually > test something. It should be a tool to create a testspecification. One > step is called teststep -> grouped to modules. Modules form a > testspecification. So it's just a Data Container (at least at the > moment). I would have to encapsulate the Data of the Teststep. The > Teststep here should act as a template. In the real spec I take the > TeststepData from the template, but the real value in the > testspecification can be changed (and should be saved). > My idea now was to encapsulate the Data the can be changed into the > Data Object, so I can use it in the template teststeps and in the > final teststeps. I would have mapped them as component, so I could > have the same Objects but in different tables (as they can have > different values). > > I hope it gets clearer what I try to do :) > > Reflection > > On 30 Sep., 13:52, "Morten Maxild" <[email protected]> wrote: > > > > > If you won't need lazy loading then a one-to-one with shared PK will do, I > > would probably still consider a one-to-many with a unique FK (PK could > > still be shared with the other side...if I remember correctly). > > > I you need any more details let me know, I have a sample project where some > > of the many kinds of 1-to-1 relations in NH are investigated. > > > Hard to answer where the polymorphic verification behaviour should be. I > > guess TestStep is better than TestData. Could also be a strategy object > > (TestVerifier) using double dispatch? > > > Integral Id is the most common case using NH > > > <id access="... " name="Id" type="int"> > > <generator class="hilo"> > > </id> > > > Personally I use Int64 for Id's. Don't use Decimal. > > > /M > > > >-----Original Message----- > > >From: [email protected] [mailto:[email protected]] On Behalf > > >Of reflection > > >Sent: Wednesday, September 30, 2009 1:01 PM > > >To: nhusers > > >Subject: [nhusers] Re: One-to-one mapping appropiate? > > > >Hello, > > > >Lazy Loading is not needed, because I actually need the Teststep Data > > >for every Teststep I get from the DB. So lazy-loading = false would be > > >set anyway on TeststepData. > > > >Yes I will need different types of TeststepData. Think of a Teststep > > >that measures a Voltage and another checking a answer to a command > > >sent. > > >Maybe I should not do the inheritance on the Data, but on the Teststep > > >class. > > > >Something like this: > > > >abstract class Teststep > > >{ > > > public Decimal Id { get; set; } > > > //some other stuff > > >} > > > >class MeasureTest:Teststep > > >{ > > > public Voltage LowerLimit { get; set; } > > > public Voltage UpperLimit { get; set; } > > >} > > > >That would also be an option and then it would be pretty easy to map > > >it by table per class hierarchy. > > > >@Decimal as Id: I would like to use int as Type for the Id property, > > >but I could not use it with NHibernate. Have tried it several times. > > >How would the mapping file look like for an Integer Id? > > > >Thank you!!! > > > >On 30 Sep., 12:21, "Morten Maxild" <[email protected]> wrote: > > >> Hi, > > > >> Do you need lazy loading of the Teststeps Data? (some mappings will make > > >NH do an outer join others will make NH do a select, and later select the > > >lazy loaded side when accessed). > > > >> What about the lifecycle of TestData, is it a standalone 'thing', or is > > >it always used in concert with its Teststep (and therefore owned by > > >Teststep)? > > > >> You need answers to these questions before you can choose between the > > >different 1-2-1 relations in NH > > > >> Also using inheritance to model TestData will limit your possibilities, > > >because components doesn't support inheritance, so you need to map TestData > > >as a persistent class with its own table(s).e > > >> /M > > > >> BTW: Decimal seems an odd type for the Id property? > > > >> >-----Original Message----- > > >> >From: [email protected] [mailto:[email protected]] On > > >Behalf > > >> >Of reflection > > >> >Sent: Wednesday, September 30, 2009 9:41 AM > > >> >To: nhusers > > >> >Subject: [nhusers] One-to-one mapping appropiate? > > > >> >Hello =) > > > >> >I'm stuck with a little mapping problem and I hope you can help me to > > >> >map things right. I've got the following class structure: > > > >> >class Teststep > > >> >{ > > >> > public Decimal TeststepId { get; set; } > > >> > public TeststepData Data { get; set; } > > > >> > //some other stuff > > >> >} > > > >> >abstract class TeststepData > > >> >{ > > >> > //some stuff all TeststepDatas have in common > > >> >} > > > >> >class TeststepData1: TeststepData > > >> >{ > > >> > public String Description { get; set; } > > >> >} > > > >> >public TeststepData2: TeststepData > > >> >{ > > >> > public int UpperLimit { get; set; } > > >> > public int LowerLimit { get; set; } > > >> >} > > > >> >May I do a one-to-one mapping to TeststepData and define TeststepData > > >> >as Table per Subclass? Would you prefer Table per Subclass or Table > > >> >per class hierarchy? Or shall I go table per concrete class? Though I > > >> >think that is a bit messy approach. > > > >> >Thanks for your help :) > > > >> >Greetings, > > >> >Reflection- Zitierten Text ausblenden - > > > >> - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
