gpt4 book ai didi

java - 如何在发生异常后删除 "null id ...entry (don' t 刷新 session )”

转载 作者:行者123 更新时间:2023-11-29 13:05:24 25 4
gpt4 key购买 nike

你好,我是 php 的 Web 开发人员,最近迁移到 javaEE。我在 mysql 中创建表。这是头等舱:

@Entity
@Table(name = "first")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, inclu`enter code here`de = "all")
public class first extends second {

@OneToOne(cascade = CascadeType.ALL)
private second A;

。。。这是我的第二堂课:

    @Entity
@Table(name = "second", uniqueConstraints =
@UniqueConstraint(columnNames = {"feildone", "feildtwo"}))
public class second implements Serializable {
@OneToOne(cascade = CascadeType.ALL, mappedBy = "first")
public static final String FindOne = "findOne";
@Id
@GeneratedValue
Integer id;
private String feildtwo;
private String feildone;
@Temporal(javax.persistence.TemporalType.DATE)
private Date createTime;
@OneToMany(cascade = CascadeType.ALL)
public List<Progress> progress = new ArrayList<>();
private Integer num;

。。.

最佳答案

尝试自动生成您的 ID,看看您是否遇到同样的问题

 @Entity
@Table(name = "second", uniqueConstraints =
@UniqueConstraint(columnNames = {"feildone", "feildtwo"}))
public class second implements Serializable {
@OneToOne(cascade = CascadeType.ALL, mappedBy = "first")
public static final String FindOne = "findOne";
@Id
@GeneratedValue(strategy = GenerationType.AUTO) // try to use auto generate id guess this might help
Integer id;
private String feildtwo;
private String feildone;
@Temporal(javax.persistence.TemporalType.DATE)
private Date createTime;
@OneToMany(cascade = CascadeType.ALL)
public List<Progress> progress = new ArrayList<>();
private Integer num;

关于java - 如何在发生异常后删除 "null id ...entry (don' t 刷新 session )”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22784271/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com