Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 402
Pracede Avatar asked Jan 29 '15 13:01

Pracede


People also ask

How do I delete my JHipster entity account?

it's simple you just need to delete the entity on the directory . jhipster/entityName. json and thats it. You can run the "yo:jhipster entity" again and override everything else.


1 Answers

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 
like image 173
Roberto Avatar answered Oct 25 '22 04:10

Roberto