I realize that it is saying that there is an string format for type integer. As I said, everything ran fine under the older version. Here are the relevant bits, I think:
The ddl:
CREATE TABLE APP.ROLE_PRIVILEGE (
COMPONENTUID INTEGER NOT NULL,
PRIVILEGEKEY VARCHAR(50) NOT NULL,
ROLEID INTEGER NOT NULL,
PRIMARY KEY (COMPONENTUID, PRIVILEGEKEY, ROLEID)
);
CREATE TABLE APP.ROLES (
ROLEID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 ,INCREMENT BY 1),
roleinheritancetype VARCHAR(20) NOT NULL,
COMPONENTID INTEGER NOT NULL);
CREATE TABLE APP.PRIVILEGES (
COMPONENTUID INTEGER NOT NULL,
DESCRIPTION VARCHAR(250),
PRIVILEGEKEY VARCHAR(50) NOT NULL,
PRIMARY KEY (COMPONENTUID, PRIVILEGEKEY)
);
CREATE TABLE APP.IMFCOMPONENT (
COMPONENTID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1 ,INCREMENT BY 1),
COMPONENTTYPE VARCHAR(10) NOT NULL,
NAME VARCHAR(50) NOT NULL);
The class annotations:
Privilege class:
@Entity
@Table(name="PRIVILEGES")
public class Privilege implements Serializable{
@EmbeddedId
private Privilege.PK pk;
private String description;
@ManyToOne(fetch=FetchType.EAGER,
cascade = CascadeType.REFRESH)
@JoinColumn(name="COMPONENTUID", insertable=false)
private Component component;
@ManyToMany(fetch=FetchType.EAGER,
cascade= CascadeType.ALL
)
@JoinTable(
name="ROLE_PRIVILEGE",
joinColumns={@JoinColumn(name="PRIVILEGEKEY"),
@JoinColumn(name="COMPONENTUID")},
inverseJoinColumns={@JoinColumn(name="ROLEID")}
)
private Set<Role> roles;
@Embeddable
public static class PK implements Serializable {
private String privilegekey;
private long componentuid;
private static final long serialVersionUID = 1L;
public PK() {
super();
}
}
}
Role class:
@Entity
@Table(name="ROLES")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="roleinheritancetype",
discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("BASEROLE")
class Role implements Serializable{
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private long roleid;
@Enumerated(EnumType.STRING)
@Column(name="ROLETYPE")
private RoleType type;
@Version
@Column(name = "OBJ_VERSION")
private int obj_version;
@ManyToOne(targetEntity=VAApp.class,
fetch=FetchType.EAGER,
cascade = { CascadeType.REFRESH
}
)
@JoinColumn(name="COMPONENTID")
private Component componentid;
@ManyToMany(
targetEntity=com.emc.imf.core.model.Privilege.class,
fetch=FetchType.EAGER ,
cascade={CascadeType.REFRESH}
)
@JoinTable(
name="ROLE_PRIVILEGE", inverseJoinColumns={@JoinColumn(name="PRIVILEGEKEY"),
@JoinColumn(name="COMPONENTUID")},
joinColumns={@JoinColumn(name="ROLEID")}
)
private Set<Privilege> privileges;
...
}
Does this help?
Shannon
_________________ Shannon Moyes Clark
|