开发者

How can I create an @Entity without a @Version field using Spring Roo?

开发者 https://www.devze.com 2023-02-19 13:12 出处:网络
I am using Spring Roo with JPA (Hibernate) for my entity model. I don\'t want to have a @Version field in some entities. How 开发者_如何学Pythoncan I do that?After the generation of entity, before exi

I am using Spring Roo with JPA (Hibernate) for my entity model. I don't want to have a @Version field in some entities. How 开发者_如何学Pythoncan I do that?


After the generation of entity, before exiting roo shell, modify entity java source file with the following

    @RooJpaActiveRecord(...... ,versionField = "")


Try using below annotation in roo

@RooJpaEntity(versionField = "",
              identifierColumn = "YOUR_DATABASE_FILEDNAME",
              identifierField = "YOUIDNAME")


Roo entity command takes --versionField and '--versionColumn' parameters. I think setting --versionField="" should do the trick for you.


There is no particular reason to remove @Version from a Roo entity, it saves the hassle of concurrent data modification issues which you might encounter with a distributed web application.

0

精彩评论

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