我阅读了很多关于我的问题的文档,但建议无法解决我的问题,所以我不得不打开这个话题。我的问题是,当我尝试保存我的实体时,出现以下错误。我添加了我的实体类。谢谢。保存代码 @Transactional@Overridepublic void saveEmployee(EmployeeTable employeeToSave){ employeeDao.saveOrUpdate(employeeToSave);}员工表package de.adesso.kkBonus.model;import com.google.common.collect.Lists;import de.adesso.kkBonus.enums.*;import de.adesso.kkBonus.util.BillConstants;import lombok.AllArgsConstructor;import lombok.Data;import lombok.EqualsAndHashCode;import lombok.NoArgsConstructor;import lombok.ToString;import org.hibernate.annotations.Cascade;import org.springframework.beans.BeanUtils;import javax.persistence.*;import java.util.ArrayList;import java.util.Date;import java.util.LinkedList;import java.util.List;@Data@AllArgsConstructor@NoArgsConstructor@Entity@Table(name = "employee_table")@EqualsAndHashCode(of = {"id"})@ToString(of = "id")public class EmployeeTable {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)@Column(name = "id")private Long id;@Column(name = "deleted")private boolean deleted;@Column(name = "name", length = 200, nullable = false)private String name;@Column(name = "tckn", length = 11)private String tckn;
2 回答
慕运维8079593
TA贡献1876条经验 获得超5个赞
调试太难了,我认为你必须检查 EmployeeTable 实体中的“毕业”对象,实际上它可能不为空,但它没有存储在数据库中,也不会在休眠中持久化,当你保存 EmployeeTable 对象时,它会抛出“对象”引用未保存的瞬态实例”异常
添加回答
举报
0/150
提交
取消