Answer the question
In order to leave comments, you need to log in
What comes first when developing a java application: a database or an entity?
Good afternoon, dear Java gurus
, please tell me which practice is more popular / correct? When is a set of java entities generated from a ready-made database structure, or when developers initially write all java entities by hand, and then spring / hibernate generates a database structure based on them?
Answer the question
In order to leave comments, you need to log in
Both are primary. It is necessary to design entities and base at the same time. For it is with entities that you work in code, so they should be convenient; but you also need to think about their representation in the database so that an inefficient solution does not turn out.
Personally, I first describe the entities in the code, then I run the database schema generator on them and check the result. If everything suits me - OK, if not, I correct the entities, file the annotations and repeat the process.
In smart books, they still recommend starting from the base, and not from auto generators from various ORMs. But no one can stop you, of course.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question