Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete an entity after creating it using jhipster?

Tags:

jhipster

I have created 3 entities (Author, Book, Library) using "yo jhipster:entity" command but in one entity (Library) I had a ManyToMany relationship (to Book) but that caused "mappedBy reference an unknown target entity property: com.tst.testdomain.domain.Book.librarys in com.tst.testdomain.docmain.Library.books" so what is the clean way of deleted the Library entity. Would a command like "yo jhipster:entitydelete" be useful?

like image 373
vijay bhatt Avatar asked Jan 29 '15 23:01

vijay bhatt


People also ask

How to update entity in JHipster?

Upgrade JHipster to the latest available version globally. Clean the current project directory. Re-generate the application using the jhipster --force --with-entities command. Commit the generated code to the jhipster_upgrade branch.


2 Answers

I use git scm for this. It's not just the generated files that need to be deleted. jHipster also modifies files so with those you need to keep the file but back out the change.

Each time I create an entity I do a separate commit so I can track what jHipster did for each entity.

To clear all changes since the last commit I do

git reset --hard git clean -fd 

If I've done that but I also need to back out the previous commit then I do

git reset --hard HEAD~1 

Commits are local with git so it's not until you push these commits that they will be shared.

like image 75
Ben Thurley Avatar answered Sep 27 '22 23:09

Ben Thurley


I do a pull request to add this feature: https://github.com/jhipster/generator-jhipster/pull/4369

To use it, it's quite simple:

yo jhipster:entity Foo --remove 

It's remove the liquibase script but after you need to deal with the table/columns family already created and not yet dropped.

Please vote or comment the issue if you are interested by this : https://github.com/jhipster/generator-jhipster/issues/4372

like image 45
Duff Avatar answered Sep 27 '22 23:09

Duff