• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring Persistence with Hibernate: which database used for samples ?

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's always a hassle to configure database settings, create tables... Most of the time, when I'm trying samples from books I'm reading, I'm using in-memory tables with hsqldb. I understand that samples should work regardless of the database being used, but which database are you using in your samples ?
 
Author
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Christophe,

We've elected to use an in-memory database for all of the examples in the book so that the example code is as self-contained as possible. Our intention is to keep the prerequisites to a bare minimum so that all you need to run the sample application is JDK5+ and Maven 2. Of course, you'll need Spring Roo and Grails installed for the examples related to those sections of the book. We won't be using any proprietary database features in the examples, so switching databases should be straight forward.

I hope that helps!

Cheers,

Brian D. Murphy
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

We've elected to use an in-memory database for all of the examples in the book so that the example code is as self-contained as possible.


That really helps. It saves time when trying to code the samples, and avoids early stage frustration related to database configuration. Thank you
 
author
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding to Brian's point, in-memory databases definitely help make it easier for readers of the book to follow along, since there is no real installation process required. However, one of the benefits of Hibernate is its ability to make your application more agnostic to the database vendor. This is another great feature of ORMs in general, and Hibernate allows you to simply select the dialect that matches your database, drop in the appropriate JDBC jars, and you're ready to go! We recommend using in-memory databases for automated testing, while leveraging a more robust database for staging and production. With Hibernate, however, you don't need to worry too much about slight incompatibilities between one database vendor and another. Instead, you can have environment-specific configuration that uses an in-memory DB for local and/or testing scenarios, while using mySQL, postgreSQL, or oracle in Production. So Hibernate provides you with flexibility and portability without requiring additional code complexity to make this happen.

Anyway, thanks again for your comment!

Best Regards,

Paul Tepper Fisher
 
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

That saves a lot of configuration hassle :-)

For some performance problems for example, one should
also dive into the actual database brand's specificities
or, in your (longer) experience, this as well can be handled
at the Hibernate level as well?

Cheers,

Gian
 
Brian Murphy
Author
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Gian,

Triaging performance problems is dependent on a huge number of factors. My preference is to do all of my development with sql logging enabled so that you can catch silly mistakes early on. When a problem rears its ugly head in production that has gone undetected by my monitoring tools, I don't want to risk adding any more overhead by messing around with my application configuration until I've tracked down a decent lead. If I suspect the persistence tier is involved, I tend to look at my application caches first and then go to the database to get more intel; which queries are being executed the most, are there long running queries, etc, etc. From there you can determine whether you should be making optimizations within your database or whether you should be diving into your Hibernate configuration.

I hope that helps!

Cheers,

Brian D. Murphy
@brimurph
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic