As Guy mentioned it is actually a bug which is why your program
compiles. It has now been filed as
https://glassfish.dev.java.net/issues/show_bug.cgi?id=736
Thanks,
Sahoo
Dmitry Mozheyko wrote:
> -----Original Message-----
> From: "Guy Pelletier" <guy.pelletier_at_oracle.com>
> To: <persistence_at_glassfish.dev.java.net>
> Date: Wed, 14 Jun 2006 07:41:56 -0400
> Subject: Re: @UniqueConstraint annotation don't works?
>
>
>> Hi Dmitry,
>>
>> The first configuration should not work, in fact, your code should not even
>> compile with that configuration.
>>
>
> Compiling, deploying without warnings and generate tables in database but without "unique cointraints".
>
>
>> Looks like the UniqueConstraint annotation has the following target
>> specification in b-48 @Target({TYPE}).
>>
>> This is incorrect, it should be: @Target({})
>>
>> Please enter a bug to have this corrected.
>>
>> Cheers,
>> Guy
>>
>> ----- Original Message -----
>> From: "Dmitry Mozheyko" <mozheyko_d_at_mail.ru>
>> To: <persistence_at_glassfish.dev.java.net>
>> Sent: Wednesday, June 14, 2006 5:30 AM
>> Subject: Re: @UniqueConstraint annotation don't works?
>>
>>
>>
>>> Sorry, the second variant is:
>>>
>>> @Entity
>>> @Table(uniqueConstraints={_at_UniqueConstraint(columnNames="name")})
>>> public class Group implements Serializable {
>>> ...
>>>
>>> and it WORKS!
>>>
>>> But why first don't works and no errors?
>>>
>>>
>>> -----Original Message-----
>>> From: Dmitry Mozheyko <mozheyko_d_at_mail.ru>
>>> To: persistence_at_glassfish.dev.java.net
>>> Date: Wed, 14 Jun 2006 13:27:13 +0400
>>> Subject: @UniqueConstraint annotation don't works?
>>>
>>>
>>>> Hello all!
>>>>
>>>> I need to use @UniqueConstraint annotation with glassfish-b48.
>>>>
>>>> I try two variants:
>>>>
>>>> @Entity(name="group_t")
>>>> @UniqueConstraint(columnNames="name")
>>>> public class Group implements Serializable {
>>>> ....
>>>>
>>>> and
>>>>
>>>> @Entity(name="group_t")
>>>> @UniqueConstraint(columnNames="name")
>>>> public class Group implements Serializable {
>>>> ....
>>>>
>>>> but i don't see result in DDL.
>>>>
>>>> DDL-generation auto with PostgreSQL database.
>>>>
>>>>