1

We started (just me and my friend) working on a website. As a part design phase we have finished the drawing a Site Map, decided on the content in each of the web page and the navigation.

As we want to use the Spring MVC and Hibernate we want to start on Classes design (domain classes) first so that the database part is taken care by Hibernate (Except for some tables for static data). Does our approach correct? Is my understanding correct that when we use Hibernate the 80% of the database design can be forgotten?

3
  • 2
    The approach you are referring to is called "code-first" in contrast to "model-first". Personally, I don't believe in the code-first approach. I think database design must be performed up-front. I am biased.
    – NoChance
    Jul 27, 2012 at 3:00
  • @EmmadKareem: code-first does not imply ignoring the database design. Sure, it can happen, but you can still keep the resulting database in mind when working code-first. Jul 27, 2012 at 6:47
  • @JoachimSauer, you are correct, thanks for hinting to this.
    – NoChance
    Jul 27, 2012 at 9:33

4 Answers 4

5

No, your database is still important

NHibernate is an object-relational mapping (ORM) solution for the projects: it provides a framework for mapping an object-oriented domain model to a traditional relational database. Thus it is important to keep your database in a good shape.

Otherwise, you may face with performance issues once you project starts to grow.

In addition, it is always pays back if you keep your database design as normalized and as good as possible.

References to support my point:

1
  • 2
    There is Hibernate for Java platform, after which NHibernate was copied.
    – Random42
    Jul 27, 2012 at 6:05
1

Your understanding is correct. Your domain model will be the key driver for database schema.

But managing the schema is best done outside of hibernate, though hibernate can create tables for you based on configuration. This way, though you have to manage database schema separately, you will have full control to manage the primary keys, constraint, foreign keys etc. Also, you need not worry about data being wiped every time you re-deploy the application.

1

You can leave it for the moment, but don't, really DON'T forget about it. It is important to keep your database in a good shape, as mentioned by others. Hibernate will create you schema, it might be okay. But have a look at it before you finish work, chances are you will find serious flaws.

Personally I'm with @Emmad Kareem. Database design has to be done up front. You can forget about 80%, your right. But make sure you don't forget about 100%.

1
  • 1
    According to Gavin King, creator of hibernate, automatic creation of the database is for developmentr environment only, production should be let to DBA.
    – Walfrat
    May 25, 2016 at 8:10
0

You can start coding without design (either database design or application design) if you are experienced and if your application is small. On the other hand there aren't applications in which too much time was spent in ; so by doing design you can be pretty sure that your applications is going to be better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.