Hi,

I have a problem using NHibernate Attributes. I have an id which
should be generated by a sequence. The sequence already exists in the
database and I just want to get next value of it. I made a query:
IQuery query = session.CreateQuery("select SEQ_QUEST.netxval from
TBL_QUEST_PRODUCT");

but it says that TBL_QUEST_PRODUCT is not mapped [select
SEQ_QUEST.netxval from TBL_QUEST_PRODUCT]

That is my Questionnaire class:
//TBL_QUEST_PRODUCT Table
    [XmlRoot("Questionnaire")]
    [NHibernate.Mapping.Attributes.Class(Table = "TBL_QUEST_PRODUCT")]
    public class Questionnaire
    {

        public Questionnaire()
        { }


        //Database entries
        //The QUEST_ID from Database

        private int _Quest_Id;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Id(Column = "QUEST_ID",
TypeType = typeof(int))]
        [NHibernate.Mapping.Attributes.Generator(1, Class="sequence")]
        public virtual int Quest_Id
        {
            get { return _Quest_Id; }
            set { _Quest_Id = value; }
        }

        //The PROD_ID from Database
        //Connects table TBL_PRODUCT
        private int _Prod_Id_Quest;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "PROD_ID",
                TypeType = typeof(int),
                NotNull = false)]
        public virtual int Prod_Id_Ques
        {
            get { return _Prod_Id_Quest; }
            set { _Prod_Id_Quest = value; }
        }

        //The QUEST_VER from Database
        //From Sequence
        private string _Quest_Version;

        [NHibernate.Mapping.Attributes.Property(0,
                Column = "QUEST_VER",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string Quest_Version
        {
            get { return _Quest_Version; }
            set { _Quest_Version = value; }
        }

        //The CREATED_ON Date from Database
        private string _Quest_Created_On;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "CREATED_ON",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string Quest_Created_On
        {
            get { return _Quest_Created_On; }
            set { _Quest_Created_On = value; }
        }

        //The CREATED_BY from Table
        private string _Quest_Created_By;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "CREATED_BY",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string Quest_Created_By
        {
            get { return _Quest_Created_By; }
            set { _Quest_Created_By = value; }
        }

        //The MODIFIED_ON from Database
        private string _Quest_Modified_On;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "MODIFIED_ON",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string Quest_Modified_On
        {
            get { return _Quest_Modified_On; }
            set { _Quest_Modified_On = value; }
        }

        //The MODIFIED_BY Person from Database
        private string _Quest_Modified_By;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "MODIFIED_BY",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string Quest_Modified_By
        {
            get { return _Quest_Modified_By; }
            set { _Quest_Modified_By = value; }
        }

        //The CHECKOUT from Database
        private string _CheckOut_Quest;

        [XmlIgnore()]
        [NHibernate.Mapping.Attributes.Property(0,
                Column = "CHECKOUT",
                TypeType = typeof(string),
                NotNull = false)]
        public virtual string CheckOut_Quest
        {
            get { return _CheckOut_Quest; }
            set { _CheckOut_Quest = value; }
        }
        //End of the Database entries


        //TBL_QUESTION_GRP entries
        private List<QuestionGroup> _QuestionGrp;

        [XmlElement("QuestionGroup")]
        public virtual List<QuestionGroup> QuestionGrp
        {
            get { return _QuestionGrp; }
            set { _QuestionGrp = value; }
        }

I would like to know how to map the table/column to the sequence.
Thank you very much in advance.
Cheers
Yana

-- 
You received this message because you are subscribed to the Google Groups 
"NHibernate Contrib - Development Group" 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/nhcdevs?hl=en.

Reply via email to