From: Gavin K. <ga...@ap...> - 2002-11-25 14:11:44
|
Since everyone should be in the process of upgrading to version 1.2 ;) you should now be using hibernate-mapping-1.1.dtd... <property name="ownernumber"> <column name="ownernumber" type="string" length="50" not-null="true" index="index_name"/> </property> ----- Original Message ----- From: "Jochen Rebhan" <joc...@si...> To: <hib...@li...> Sent: Tuesday, November 26, 2002 1:07 AM Subject: [Hibernate] How to create an index on normal property element ? > > I have the following hibernate-mapping definition for "Friend" : > > <class name="buddy.database.Friend" table="friends"> > <id column="friends_key" name="key" type="long"> > <generator class="native"/> > </id> > <set role="meetings" lazy="true" table="participants"> > <key type="long" column="friends_key"/> > <many-to-many class="buddy.database.Meetings" column="meetings_key"/> > </set> > <property name="name" column="name" type="string" length="50"/> > <property name="number" column="number" type="string" length="50" not-null="true"/> > > > <!-- I want to index this element: ownernumber to speed up some queries --> > <property name="ownernumber" column="ownernumber" type="string" length="50" not-null="true"/> > > > <property name="active" column="active" type="boolean" length="50" /> > > </class> > > > > > In Mysql I have to add this line manually (after running the Schema generator) : > > create index ownerindex on friends (ownernumber); > > > > As I see in the DTD there is no way to specify an index for a normal property, am I wrong ? > > > > <!ELEMENT property (column*)> > <!ATTLIST property name CDATA #REQUIRED> > <!ATTLIST property type CDATA #IMPLIED> > <!ATTLIST property column CDATA #IMPLIED> > <!ATTLIST property length CDATA #IMPLIED> > <!ATTLIST property not-null (true|false) "false"> > <!ATTLIST property unique (true|false) "false"> > > > Thanks for any help, Hibernate is great ! > > > Jochen Rebhan > joc...@si... > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |