How can I create an @Entity without a @Version field using Spring Roo?
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.
精彩评论