使用旧列映射的Hibernate

时间:2017-01-27 14:22:38

标签: java mysql hibernate jpa

我最近更改了模式中的一些列名,并根据此更改更新了hibernate映射,但似乎@JoinColumn映射使用旧的列名而不是已输入的新列名。 这是我的映射文件:

function getUrl(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s1 = ss.getSheetByName("Sheet1");
  var src_range = s1.getRange("B:B");  // Grab the Column B range
  var regExp = /(.*?)\(([^)]+)\)/;     // Define the regex
  for(i = 1; i<=src_range.getLastRow(); i++) { // Loop through all the cells in the range
    if (!src_range.getCell(i, 1).isBlank()) {  // If the cell is not blank, process it
      var m =  regExp.exec(src_range.getCell(i, 1).getValue()); // Run the regex
      if (m) {            // If there is a match
        var text = m[1];  // Text to be placed into Column C
        s1.getRange('C' + i).setValue(text);
        var url = m[2];   // URL to be placed into Column D
        s1.getRange('D' + i).setValue(url);
      }
    }
  }
}

所有4个@JoinColumn变量似乎都在使用旧值,但其他映射都使用了新值..有没有人见过这个?

以下是生成的SQL查询:

@Entity
@Table(name = "matches")
public class MatchDao {
    public static final String ID = "id";
    public static final String USER1_ID = "user1_id";
    public static final String USER2_ID = "user2_id";
    public static final String USER1_ROUND_ID = "user1_round_id";
    public static final String USER2_ROUND_ID = "user2_round_id";
    public static final String MATCH_START_DATE = "match_start_date";
    public static final String MATCH_COMPLETED_DATE = "match_completed_date";
    public static final String PLAYER1_MATCH_REPORT_SEEN = "player1_match_report_seen";
    public static final String PLAYER2_MATCH_REPORT_SEEN = "player2_match_report_seen";

    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = ID)
    private int id;

    @JoinColumn(table = "user", referencedColumnName = UserDao.ID, name = USER1_ID, nullable = false)
    private Integer user1Id;

    @JoinColumn(table = "user", referencedColumnName = UserDao.ID, name = USER2_ID)
    private Integer user2Id;

    @JoinColumn(table = "round", referencedColumnName = RoundDao.ID, name = USER1_ROUND_ID)
    private Integer user1RoundId;

    @JoinColumn(table = "round", referencedColumnName = RoundDao.ID, name = USER2_ROUND_ID)
    private Integer user2RoundId;

    @Column(name = MATCH_START_DATE)
    private Date matchStartDate;

    @Column(name = MATCH_COMPLETED_DATE)
    private Date matchCompletedDate;

    @Column(name = PLAYER1_MATCH_REPORT_SEEN)
    private Date player1MatchReportSeen;

    @Column(name = PLAYER2_MATCH_REPORT_SEEN)
    private Date player2MatchReportSeen;

0 个答案:

没有答案