openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ignacio Andreu" <plunch...@gmail.com>
Subject Re: @UniqueConstraint annotation
Date Tue, 28 Aug 2007 10:45:11 GMT
Hi,

Regarding the documentation about OpenJPA you can define a unique column
with something like that:

@Entity
@Table(name="ART", uniqueConstraints=@Unique(columnNames="TITLE"))
public class Article {
    ...
}

And in XML

<entity class="org.mag.Article">
    <table name="ART">
        <unique-constraint>
            <column-name>TITLE</column-name>
        </unique-constraint>
    </table>
    ...
</entity>

For more information see the "Unique Constraints" section [1]

- Ignacio


[1]
http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_overview_mapping_unq

On 8/28/07, ben short <jamin.short@gmail.com> wrote:
>
> Hi,
>
> I am trying to use the @UniqueConstraint annotation but get the
> following error message..
>
> OpenJPA does not yet support the @UniqueConstraint annotation.
>
> Is that any plan to implement this feature in the near future? Can I
> define the mapping for the class that I'm trying to annotate in xml
> rather than use the annotations to use the UniqueConstraint feature?
>
> Regards
>
> Ben Short
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message