Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
I would like to create a unique index on columns(LOGIN_NAME/PASSWORD). what is the syntax to have this generated from the mapping. thanks in advance
Scott
Hibernate version:2.18
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.ipdsserver.persistence.Contact" table="CONTACT">
<meta attribute="class-description">
Represents a contact.
</meta>
<id name="id" type="long" column="CONTACT_ID">
<meta attribute="scope-set">protected</meta>
<meta attribute="field-description">Unique identity - automatically generated</meta>
<generator class="native" />
</id>
<property name="firstName" type="string">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">The contact's first name</meta>
<column name="FNAME" length="40" not-null="true" />
</property>
<property name="middleName" type="string">
<meta attribute="field-description">The contact's middle name</meta>
<column name="MNAME" length="40" />
</property>
<property name="lastName" type="string">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">The contact's last name</meta>
<column name="LNAME" length="40" not-null="true" />
</property>
<property name="phone" type="string">
<meta attribute="field-description">The contact's phone number</meta>
<column name="PHONE" length="40" />
</property>
<property name="email" type="string">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">The contact's email address</meta>
<column name="EMAIL_ADDRESS" length="60" not-null="true" />
</property>
<many-to-one name="type" column="TYPE_ID"
class="com.ipdsserver.persistence.ContactType"
cascade="save-update"
not-null="true" />
<many-to-one name="role" column="ROLE_ID"
class="com.ipdsserver.persistence.Role"
cascade="save-update"
not-null="true" />
<many-to-one name="mainAddress" column="MAIN_ADDRESS_ID"
class="com.ipdsserver.persistence.Address"
cascade="save-update"
not-null="true" />
<set name="addresses" table="ADDDRESS" cascade="all">
<key column="CONTACT_ID" />
<one-to-many class="com.ipdsserver.persistence.Address" />
</set>
<property name="loginName" type="string">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">The login name for the contact</meta>
<column name="LOGIN_NAME" length="25" not-null="true"/>
</property>
<property name="password" type="string">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">The password for the contact</meta>
<column name="PASSWORD" length="30" not-null="true"/>
</property>
<property name="lastSaved" type="timestamp">
<meta attribute="field-description">The contact's last saved date</meta>
<column name="LAST_SAVED" not-null="true" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: