java - JPA orm.xml support for database index -
i not see option like, in orm.xml file, of jpa2.
<basic name="developer"> <index /> <column name="developer"/> </basic>
i see there hbm.xml files, offers that, wonder if jpa 2.0 lacks feature part of standard.
so can avoid transformation hbm.xml files...
jpa 2.0 table
xsd type looks this:
<xsd:complextype name="table"> <xsd:sequence> <xsd:element name="unique-constraint" type="orm:unique-constraint" minoccurs="0" maxoccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="catalog" type="xsd:string"/> <xsd:attribute name="schema" type="xsd:string"/> </xsd:complextype>
while jpa 2.1 looks follows:
<xsd:complextype name="table"> <xsd:sequence> <xsd:element name="unique-constraint" type="orm:unique-constraint" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="index" type="orm:index" minoccurs="0" maxoccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="catalog" type="xsd:string"/> <xsd:attribute name="schema" type="xsd:string"/> </xsd:complextype>
so, don't have index
attribute on table
type that's provided on per-entity level:
<entity class="post" access="field"> <table> <index column-list="first_name,last_name" name="name_idx" unique="true"/> </table> <attributes> ... </attributes> </entity>
however, don't need use hbm2ddl in application. use flyway instead , way better off.
Comments
Post a Comment