その戦略が実行された場合、Hib は単に id 設定を無視します。
それを回避して戦略を保存する方法はありますか?
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Long getId() {
return id;
}
...
Account account = new Account();
account.setId(1000L);
account.setSmth(smth);
...
//Tried to do so, but tomcat hangs on this string.
session.createSQLQuery("ALTER TABLE account AUTO_INCREMENT = " + account.getId() + ";").executeUpdate();
session.save(account);
...
スパシボ!