二哈大叔 2017-02-20 03:09 采纳率: 25.6%
浏览 1289
已结题

SSH集成hibernate配置一对一关系出错

先说明一下我的问题,我想做的是对某个表的更新操作,但是我发现更新操作虽然执行了但是没有更新数据,后来想到是因为这个表中有一个字段是另一个表的主键,也就是这两个表有关联,一个表是用户表YSysUserinfo,一个表是学生表SysStudentUserInfo,现在学生表有一个YSU_ID是用户表的主键,现在想给他们配置外键关联一对一的关系,但是运行查询就会出错,配置和错误马上就贴出

  • 写回答

9条回答 默认 最新

  • 二哈大叔 2017-02-20 03:13
    关注

    这是我的学生实体类
    package com.ffour.yixing.entity;
    // Generated 2017-2-16 15:45:33 by Hibernate Tools 4.0.0

    import java.math.BigDecimal;

    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.SequenceGenerator;

    /**

    • SysStudentUserInfo generated by hbm2java
      */
      public class SysStudentUserInfo implements java.io.Serializable {
      @SequenceGenerator(name = "SYS_STUDENT_USER_INFO$SEQ",sequenceName="SYS_STUDENT_USER_INFO$SEQ",allocationSize=1)
      @GeneratedValue(generator="SYS_STUDENT_USER_INFO$SEQ",strategy = GenerationType.SEQUENCE)
      @Id
      private long ssuiId;
      private Long ysuId;
      private String studentName;
      private Short studentSex;
      private String photoInfoUrl;
      private String studentSchool;
      private String studentMajor;
      private String studentSpecialty;
      private Short studentHeight;
      private Short studentWeight;
      private String studentPhone;
      private String studentQq;
      private BigDecimal studentScore;
      private String studentIntroduce;
      private Short studentEntrust;
      private YSysUserinfo userInfo;

      public SysStudentUserInfo() {
      }

      public SysStudentUserInfo(long ssuiId) {
      this.ssuiId = ssuiId;
      }

      public SysStudentUserInfo(long ssuiId, Long ysuId, String studentName, Short studentSex, String photoInfoUrl,
      String studentSchool, String studentMajor, String studentSpecialty, Short studentHeight,
      Short studentWeight, String studentPhone, String studentQq, BigDecimal studentScore,
      String studentIntroduce, Short studentEntrust) {
      this.ssuiId = ssuiId;
      this.ysuId = ysuId;
      this.studentName = studentName;
      this.studentSex = studentSex;
      this.photoInfoUrl = photoInfoUrl;
      this.studentSchool = studentSchool;
      this.studentMajor = studentMajor;
      this.studentSpecialty = studentSpecialty;
      this.studentHeight = studentHeight;
      this.studentWeight = studentWeight;
      this.studentPhone = studentPhone;
      this.studentQq = studentQq;
      this.studentScore = studentScore;
      this.studentIntroduce = studentIntroduce;
      this.studentEntrust = studentEntrust;
      }

      public long getSsuiId() {
      return this.ssuiId;
      }

      public void setSsuiId(long ssuiId) {
      this.ssuiId = ssuiId;
      }

      public Long getYsuId() {
      return this.ysuId;
      }

      public void setYsuId(Long ysuId) {
      this.ysuId = ysuId;
      }

      public String getStudentName() {
      return this.studentName;
      }

      public void setStudentName(String studentName) {
      this.studentName = studentName;
      }

      public Short getStudentSex() {
      return this.studentSex;
      }

      public void setStudentSex(Short studentSex2) {
      this.studentSex = studentSex2;
      }

      public String getPhotoInfoUrl() {
      return this.photoInfoUrl;
      }

      public void setPhotoInfoUrl(String photoInfoUrl) {
      this.photoInfoUrl = photoInfoUrl;
      }

      public String getStudentSchool() {
      return this.studentSchool;
      }

      public void setStudentSchool(String studentSchool) {
      this.studentSchool = studentSchool;
      }

      public String getStudentMajor() {
      return this.studentMajor;
      }

      public void setStudentMajor(String studentMajor) {
      this.studentMajor = studentMajor;
      }

      public String getStudentSpecialty() {
      return this.studentSpecialty;
      }

      public void setStudentSpecialty(String studentSpecialty) {
      this.studentSpecialty = studentSpecialty;
      }

      public Short getStudentHeight() {
      return this.studentHeight;
      }

      public void setStudentHeight(Short studentHeight) {
      this.studentHeight = studentHeight;
      }

      public Short getStudentWeight() {
      return this.studentWeight;
      }

      public void setStudentWeight(Short studentWeight) {
      this.studentWeight = studentWeight;
      }

      public String getStudentPhone() {
      return this.studentPhone;
      }

      public void setStudentPhone(String studentPhone) {
      this.studentPhone = studentPhone;
      }

      public String getStudentQq() {
      return this.studentQq;
      }

      public void setStudentQq(String studentQq) {
      this.studentQq = studentQq;
      }

      public BigDecimal getStudentScore() {
      return this.studentScore;
      }

      public void setStudentScore(BigDecimal studentScore) {
      this.studentScore = studentScore;
      }

      public String getStudentIntroduce() {
      return this.studentIntroduce;
      }

      public void setStudentIntroduce(String studentIntroduce) {
      this.studentIntroduce = studentIntroduce;
      }

      public Short getStudentEntrust() {
      return this.studentEntrust;
      }

      public void setStudentEntrust(Short studentEntruts) {
      this.studentEntrust = studentEntruts;
      }

      public YSysUserinfo getUserInfo() {
      return userInfo;
      }

      public void setUserInfo(YSysUserinfo userInfo) {
      this.userInfo = userInfo;
      }

    }

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!