Hibernate version: 1.2.1 GA
Name and version of the database you are using: MS SQL 2k(5)
I'm wondering if its possible to map a class from a lookup table. I have a table that has a number of system wide settings and options in it (CM_OPTION), and I'd like to be able to pull a number of them out to populate a class. Is there an easy way to do this?
Code:
CREATE TABLE [dbo].[CM_OPTION](
[OPTION_ID] [int] IDENTITY(1,1) NOT NULL,
[SECTION_NAME] [varchar](15) NULL,
[OPTION_NAME] [varchar](60) NOT NULL,
[OPTION_VALUE] [varchar](4096) NULL,
...)
I have a class say,
Code:
class CompanyDetails {
public string CompanyName;
public string Address;
}
CM_OPTION contains the CompanyName and Address, where the SECTION_NAME is "CompanyDetails", and the OPTION_NAME and OPTION_VALUE are the property names and values I want to pull out.
I'm not expecting to be able to create a generic mapping for any class from the CM_OPTION table, however mapping the name / value pairs onto the properties just for the CompanyDetails class is hard enough! (unless I'm missing something!)
Thanks for any ideas
Phil