Search Results

Search found 3 results on 1 pages for 'ris90'.

Page 1/1 | 1 

  • NHibernate GenericADO Exception

    - by Ris90
    Hi, I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with this mapping: <class name="Recruit" table="Recruits"> <id name="ID"> <generator class="native"/> </id> <property name="Lastname" column="lastname"/> <property name="Name" column="name"/> <property name="MedicalReport" column="medicalReport"/> <property name="DateOfBirth" column ="dateOfBirth" type="Date"/> <many-to-one name="AssignedOnRecruitmentOffice" column="assignedOnRecruitmentOffice" class="RecruitmentOffice"/> which is many-to-one connected to RecruitmentOffices: <class name="RecruitmentOffice" table="RecruitmentOffices"> <id name="ID" column="ID"> <generator class="native"/> </id> <property name="Chief" column="chief"/> <property name="Name" column="name"/> <property name ="Address" column="address"/> <set name="Recruits" cascade="save-update" inverse="true" lazy="true"> <key> <column name="AssignedOnRecruitmentOffice"/> </key> <one-to-many class="Recruit"/> </set> And create Repository class with method Insert: public void Insert(Recruit recruit) { using (ITransaction transaction = session.BeginTransaction()) { session.Save(recruit); transaction.Commit(); } } then I try to save new recrui to base: Recruit test = new Recruit(); RecruitmentOffice office = new RecruitmentOffice(); ofice.Name = "test"; office.Chief = "test"; test.AssignedOnRecruitmentOffice = office; test.Name = "test"; test.DateOfBirth = DateTime.Now; RecruitRepository testing = new RecruitRepository(); testing.Insert(test); And have this error GenericADOException could not insert: [OSiUBD.Models.DAO.Recruit][SQL: INSERT INTO Recruits (lastname, name, medicalReport, dateOfBirth, assignedOnRecruitmentOffice) VALUES (?, ?, ?, ?, ?); select SCOPE_IDENTITY()] on session.Save

    Read the article

  • Asp.net mvc inheritance controllers

    - by Ris90
    Hi, I'm studing asp.net mvc and in my test project I have some problems with inheritance: In my model I use inheritanse in few entities: public class Employee:Entity { /* few public properties */ } It is the base class. And descendants: public class RecruitmentOfficeEmployee: Employee { public virtual RecruitmentOffice AssignedOnRecruitmentOffice { get; set; } } public class ResearchInstituteEmployee: Employee { public virtual ResearchInstitute AssignedOnResearchInstitute { get; set; } } I want to implement a simple CRUD operations to every descedant. What is the better way to inplement controllers and views in descendants: - One controller per every descendant; - Controller inheritance; - Generic controller; - Generic methods in one controller. Or maybe there is an another way? My ORM is NHibernate, I have a generic base repository and every repository is its descedant. Using generic controller, I think, is the best way, but in it I will use only generic base repository and extensibility of the system will be not very good. Please, help the newbie)

    Read the article

1