users@glassfish.java.net

ON DELETE RESTRICT via annotation?

From: <glassfish_at_javadesktop.org>
Date: Mon, 07 Jul 2008 11:57:53 PDT

Assume the following

acl_user(id int primary key)
acl_group(id int primary key)

user_group (
acl_userid int references acl_user on delete restrict,
acl_groupid int references acl_group on delete restrict,
primary key (acl_userid, acl_groupid) );

I currently have the following on acl_user...

   @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY)
   @JoinTable(
       name = "user_group",
       schema = "public",
       joinColumns = { @JoinColumn(
           name = "acl_userid",
           nullable = false,
           updatable = false
       ) },
       inverseJoinColumns = { @JoinColumn(
           name = "acl_groupid",
           nullable = false,
           updatable = false
       ) }
   )

and this on acl_group...

   @ManyToMany(
       cascade = CascadeType.ALL,
       fetch = FetchType.LAZY,
       mappedBy = "aclGroups"
   )

Any idea why I still end up with "ON UPDATE NO ACTION ON DELETE NO ACTION" for each filed when the DB is generated?

To simplify, I'm after "ON DELETE RESTRICT" for each foreign key in user_group.

Any idea what I'm doing wrong?

-David
[Message sent by forum member 'dnedrow' (dnedrow)]

http://forums.java.net/jive/thread.jspa?messageID=284830