Hi, I can think of two options for your problem:
1 - Adding a primary key as an incremental column in your Fact Tables or 2 - Create a composite-id for the Fact Tables from all the Foreign keys ( if it defines a unique identification ) Personally I would take option 1 since it is simpler to map with NHibernate and since it is just for reading I would also consider to add a single primary key column for Dimension Tables. Hope it helps. On Thu, Mar 5, 2009 at 11:49 PM, Gabriele Tassi <[email protected]>wrote: > > I have a problem using NHibernate in a way that maybe is a bit > unorthodox. > What I'm trying to do is to query a star schema in a datawarehouse > using Hql. > > Now you may say: "What you're trying to do is wrong. If it doesn't > work it's your fault. Don't bother me!", and you wouldn't be too far > from being right. Anyway, I know I'm trying to do something completely > out of any best practice, so please don't try to explain me that I > shouldn't. > > Basically I'm mapping dimension tables as entities, and that's cool > because dimension tables have primary keys, otherwise how could they > be referenced by fact tables? So I use primary keys of dimension > tables as identifiers. > > Fact tables, instead, only have foreign keys towards dimension tables > plus some numeric measures: no primary key is present, if you do not > consider the unique index on the set of all foreign keys. So I cannot > define an identifier and my mappings are rejected. > > Both dimension tables and fact tables are populated by Etl procedures, > so as far as NHibernate is concerned they are read-only objects. I > don't use NHibernate for inserts or updates, only to perform Hql > queries. So Identifiers are really used only for reference: since fact > tables are never referenced it would be ok for them not to have ids, > still NHibernate seems to require identifiers anyway, even if thay are > never going to be used. > > Why bother using NHibernate? If I'd do it, I could benefit from a lot > of other stuff I've developed. > > Do you have ideas? Do you think this is possible somehow? > > Thanks everybody! > > > > -- Humberto C Marchezi --------------------------------------------------------- Master in Electrical Engineering - Automation Software Consultant and Developer at the Town Hall of Vitória --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
