开发者

hibernate - another auto generated field which is not the ID

开发者 https://www.devze.com 2023-02-20 12:53 出处:网络
I want to create another autogenerated field in my class. I followed开发者_开发百科 this unanswered question - with no success

I want to create another autogenerated field in my class.

I followed开发者_开发百科 this unanswered question - with no success

https://stackoverflow.com/questions/4930762/generate-an-auto-generated-value-of-a-field-under-java-hibernate-id-generatedv

I need even a more simple thing - I want my second field - to receive the same value as the @ID @AutoGenerated. Is there a way to do that?


As an example try like this.

@GeneratedValue(strategy = IDENTITY)
    @Column(name = "columnName", unique = true, nullable = false, insertable = false, updatable = false)
    private Integer columnName;
0

精彩评论

暂无评论...
验证码 换一张
取 消