i am writing an application in it i am using NHibernate
with SQLite
.
i have a table that have a column and i want it be unique and on conflict replace.
this is my .hbm.xml
mapping file codes.
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="TaxeeManager"
namespace="TaxeeManager.Database">
<class name="Office" table="offices">
<id name="Id" column="id">
<generator class="identity" />
</id>
<property name="Name" column="name" />
<property name="Address" column="address" />
<property name="ManagerName" column="managername" />
<property name="Email" column="email" />
<property name="WebSite" column="website" />
<property name="Phone1" column="phone1" />
<property name="Phone2" column="phone2" />
<property name="Phone3" column="phone3" />
<property name="Picture" column="picture" />
<property name="Mid" column="mid" unique="true"/>
<property name="RegisterId" column="registerid" />
<property name="Latitude" column="latitude" />
<property name="Longitude" column="longitude" />
</class>
</hibernate-mapping>
my unique column is mid
.
My table
finally must be like this.
CREATE TABLE offices (id integer primary key autoincrement, name TEXT, address TEXT, managername TEXT, email TEXT, website TEXT, phone1 TEXT, phone2 TEXT, phone3 TEXT, picture TEXT, mid BIGINT UNIQUE ON CONFLICT REPLACE, registerid TEXT, latitude DOUBLE, longitude DOUBLE)
How i can do this?
Aucun commentaire:
Enregistrer un commentaire