Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] on delete restrict?

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


Back to the top