JPA 2.0を使用していて、アノテーションではなくXMLを使用して一意の制約を作成したいと考えています。
注釈付きクラスは次のようになります。
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
@Column(unique=true)
private String name;
// ..
}
そして、そのorm.xml
ようなファイル-しかし、それはユニークな制約を欠いています:
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">
<entity class="kiosk.model.Person">
<attributes>
<id name="id">
<generated-value strategy="AUTO" />
</id>
<basic name="name" />
<!-- .. -->
</attributes>
</entity>
</entity-mappings>
XMLを使用してJPA2.0クラスに一意の制約を追加するにはどうすればよいですか?