How do I generate tables / database schema from NHibernate mapping file (XML) -
i have xml file information of tables column names , types. how create table in sql server 2008.
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="op" table="op" dynamic-update="true"> <id name="id" column="id"> <generator class="native" /> </id> <property name="accountid" column="account_id" not-null="true"/> <property name="date" column="date" not-null="true" type="timestamp"/> <property name="amount" column="amount" not-null="true"/> <many-to-one name="accountprop" column="account_id" class="account" not-null="true"/> <joined-subclass name="payoperation" table="pay_operations"> <key column="operation_id" />
perform schemaexport when build session factory.
e.g.
new schemaexport(cfg).execute(true, true, true);
Comments
Post a Comment