users@glassfish.java.net

Re: Entity design

From: Aleksandras Novikovas <an_at_systemtier.com>
Date: Wed, 18 Mar 2009 22:23:05 +0200

uniqueConstraints used only in DDL. For runtime it has no effect.
If your database will be generated from entities then it is enough.

If you already have database created then you have to alter it:
ALTER TABLE Municipality ADD CONSTRAINT UNIQUE(district_id, name);

-
Aleksandras Novikovas



On Wed, 2009-03-18 at 12:45 -0700, glassfish_at_javadesktop.org wrote:
> Ah, like this?
> @Table(name="municipality" uniqueConstraints = {_at_UniqueConstraint(columnNames = {"district_id", "name"})})
>
> /Mattias
>
> > Hi,
> >
> > Just add UNIQUE index on Municipality (district_id,
> > name) in database.
> >
> > -
> > Aleksandras Novikovas
> >
> [Message sent by forum member 'nightzero' (nightzero)]
>
> http://forums.java.net/jive/thread.jspa?messageID=337794
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>