unique « HBM « JPA Q&A





1. How to do multiple column UniqueConstraint in hbm?    stackoverflow.com

Working on some legacy hibernate code. How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations?

@Table(name="users", uniqueConstraints = {
    @UniqueConstraint(columnNames={"username", "client"}),
    @UniqueConstraint(columnNames={"email", ...

2. How to create two-column unique key constrain with HBM mapping?    stackoverflow.com

I have a hibernate mapping:

<properties name="lrt_bps_bpr_acs_uk" unique="true">
    <many-to-one name="activitySummary" column="bps_acs_id" class="xyz.ActivitySummary"
    unique-key="lrt_bps_bpr_acs_uk"/>
    <many-to-one name="bestPractice" column="bps_bpr_id" class="xyz.BestPractice" 
      ...

3. hbm2ddl tool to create unique constraint for mulitple column    forum.hibernate.org

Hi All, I've searched and searched, but haven't come across the answer to how to generate ddl script to create a multiple column unique constraint for a table. The Goal: to create DDL Scripts to create a database from XDoclet javadoc tags in my java code. Tools: XDoclet hbm2ddl (runs via ant task, schemaexport) Status: So far, I've got it running ...