Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
608 views
in Technique[技术] by (71.8m points)

java - How to modify existing entity generated with jhipster?

I use jhipster generator to create a projet. I've generated some entity manually following the information provided in jhipster documentation :

If you prefer (or need) to do a database update manually, here is the development workflow: Modify your JPA entity (add a field, a relationship, etc.) Create a new "change log" in your src/main/resources/config/liquibase/changelog directory. The files in that directory are prefixed by their creation date (in yyyyMMddHHmmss format), and then have a title describing what they do. For example, 20141006152300_added_price_to_product.xml is a good name. Add this "change log" file in your src/main/resources/config/liquibase/master.xml file, so it is applied the next time you run your application If you want more information on using Liquibase, please go to http://www.liquibase.org.

Here the documentation just mention, how to add!!! What to do if i want to delete a field or a relation between entities (jpa entity) ?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

1) Edit the json file representing your entity (add/remove field, the syntax is pretty easy, check in the end of the file if is required any change to the general entity properties like 'fieldsContainOneToMany'...), you'll find it in:

<jhipster_root_folder>/.jhipster/entityName.json

2) Build the code.

3) In the root of your project run the command:

yo jhipster:entity entityName

NOTE: this command by default overwrite all your manual changes. I recommend to do a commit on a VCS repository before to run this command to eventually revert any not required change.

4) run

mvn liquibase:diff

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...