Hib는 그 전략이 자리를 잡으면 id 설정을 무시한다.최대 절전 모드 : 사용자 정의 id를 가진 엔티티를 case에 넣는다 : strategy = GenerationType.AUTO
이를 방지하고 전략을 저장하는 방법이 있습니까?
@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);
...
Spasibo!