Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jHipster what order to create entities

Tags:

jhipster

I'm trying to start an application and my idea was to rattle off the entities first using the command line and then work on the UI. This is proving trickier than I first thought because under certain circumstances you get a warning saying the generator won't work. It's things like whether it's a OneToMany or a ManyToOne or whether this entity is the owning side of the relationship.

What's the best way around this?

If I can work out the rules then I can maybe decide what order to create things in. My worry is that with a complicated schema there is no order that can work without some warnings and things not working.

My other idea was to generate the entities without relationships first and then edit the json files to add the relationships. Then maybe I can run the generator again on each entity. Not sure if that would work though and I'm not 100% sure of the correct json properties required.

What have other people tried?

like image 244
Ben Thurley Avatar asked Feb 19 '15 15:02

Ben Thurley


1 Answers

Plan your entities and relationships, so that when you create an entity all the entities it depends on have already been created. One way to do this is use a schema designer or just document the entities and put them in the order they need to be created.

Otherwise, as you know, you'll have to manually wire those relationships, or recreate them with the entity generator.

But, even with planning, you're going to have to use a mixture of these methods in the real world. It just depends on how much you've modified the generated code as to which method is the fastest.

like image 166
Rori Stumpf Avatar answered Nov 25 '22 23:11

Rori Stumpf