This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes ORM for normalization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "ORM for normalization" Watch "ORM for normalization" New topic
Author

ORM for normalization

Joseph Marques
Greenhorn

Joined: May 01, 2005
Posts: 12
Recently I came across a database developer that didn't like to normalize. I wanted to use Hibernate to create an object representation of that data, but it was extremely difficult because things were very flat. Are there any handy tricks that anyone knows of to overcome scenarios like this? Any insight would be appreciated.
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Your best bet may be to ditch the database developer.

If that's not possible and you can't work with him to revise the database schema, you could try creating views to provide your application with a normalized version of the data.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700
    
    5

There are many times is it good in production environments to throw out normalization, such as when the performance hit of joining the tables vastly exceeds the performance hit of maintaining the denormalized structure.

As Scott said though, you can use Views and/or Triggers in a db environment to automate some of these tasks to make your data appear normalized or denormalized when it isn't.

Hibernate, like JDO, does support inheritence mappings (vertical, horizontal, flat) and if the data is as difficult to work with as you say, applying one of these patterns might help. Ultimately, if the data is too forgone for object mapping tools, then your best bet is to restructure it.


My Blog: Down Home Country Coding with Scott Selikoff
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Yes, I agree completely. Sometimes normalization is not desirable.

Especially when the ratio of updates to reads is very low and join performance is an issue like in a reporting application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ORM for normalization
 
Similar Threads
Volunteer Java Programmer
5001 error in client side.
looking for another game about JAVA like COW game
Facing problems
java.io.Exception