我的域名类:
'//:my_proto' does not have mandatory provider 'py'.
这是我的测试方法:
@Entity
@Table(name="ZZ_USER_INFO", schema="PDS_OWNER")
public class User implements Serializable{
private static final long serialVersionUID = 1317056412866001134L;
public User(){
}
@EmbeddedId
private UserPk userPk;
@Column(name="AGE", nullable=false)
private int userAge;
public UserPk getUserPk() {
return userPk;
}
public void setUserPk(UserPk userPk) {
this.userPk = userPk;
}
public int getUserAge() {
return userAge;
}
public void setUserAge(int userAge) {
this.userAge = userAge;
}
}
public class UserPk implements Serializable{
private static final long serialVersionUID = 237150872186063319L;
public UserPk(){
}
@SequenceGenerator(name="ZZ_USER_INFO_SEQ", sequenceName="ZZ_USER_INFO_SEQ")
@GeneratedValue(strategy = GenerationType.AUTO, generator="ZZ_USER_INFO_SEQ")
@Column(name="USER_ID", nullable=false)
private long userId;
@Column(name="USER_NAME", nullable=false)
private String userName;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
当我在@EmbeddedId中使用@SequenceGenerator时,它在Oracle中不起作用。在表中,我看到USER_ID列中的默认值为零。
当我使用@Id时,相同的代码工作正常。
有人可以帮我解决如何在JPA @EmbeddedId(复合键)中使用Oracle sequecne生成器
感谢您的帮助。