mapping - nhibernate 'virtual' fields -


I want to field a 'virtual' in a nhibernate class (not there, be confused with the virtual keyword).

I have a security table and I want a 'virtual' area which uses another area to return a flag.

I've added a count field to the db_securities table nhibernate class:

  public class DB_Securities {Private string cusip; Private string security description; ... private string class code; ... private string is sweepback; ... Public Virtual String ClassCode {get {return classCode; } Set {classCode = value; }} ... Public Virtual String IsSweepAccount {getSweepAccount = (classCode> 20 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; ; Amp; amp; amp; amp ;; & amp ;;; class & amp; ;; lt; 25)? "Y": "N"; Returns is SweepAccount; } Set {isSweepAccount = value; }}}  

I have DB_Securities.hbm.xml

   & Lt; / Id & gt; & Lt; Property name = "security description" type = "string" length = "36" /> ... & lt; Property name = "class code" type = "string" length = "3" /> ... & lt; Property Name = "IsSweepAccount" type = "string" update = "false" = "false" />  

I think it should allow me to access the field IsSweepAccount, although it was in the table, but I am getting:

  Internal exception = Invalid column name 'IsSweepAccount'.  

And SQL is showing that he is making a selection and refers to the name of that column, which should be fine.

I did a lot of work in Java / Hibernate about one year successfully

I have no reason to include that field in the mapping file, because it does not persist on the database. If you want to continue this, you can map a SWEPAccount private member using an Admissions Strategy and Naming Convention.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -