Click here to Skip to main content
15,845,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I am new to Nhibernate. i want to pass a parameter to .hbm file without using createcriteria() method here is my hbm file.

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyAssembly" namespace="MyAssembly">
  <class name="Product" table="Product">
    <id name="Id" column="id">
      <generator class="native" />
    <property name="Created" column="Created" not-null="true" />
    <property name="ProductName"  formula="(select top 1 p.productname from product p where p.productname='i want to pass a parameter here as dynamic')"/>
    <property name="IsActive" column="IsActive" not-null="true" />

As mentioned above product name has to pass dynamic.

Kindly help me anyone, how to do it.

Updated 8-Oct-15 2:07am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900