• 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

How to achieve transparency layers using ORM

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Currently i am using ORM through hibernate in a project where i have two options while designing my data models and its mapping with db tables.

1. Create the data models a replica copy of tables in db, so that while using hibernate i can easily map each row to a object in java. but leads me to a large size of data in db. Which can be a performance hindrance parameter
after 1-2 years.

2. I can create data models by using my own explicit logic on objects obtained from db, in this case also i will use hibernate but i have to create my own new data models for internal functioning of application after using data from data models mapped to certain tables in db. This will even reduce size of my tables to a great extent and will not cause any performance hindrance but this will break the ORM pattern partially because it will give be objects but i have to convert them into one useful for my application logic.

Please suggest me the write approach to be used.

Regards,
Ajay
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand why having a data model in your code be a replica of tables in db increases the size of the database. If the database architecture is done correctly, the database is not de-normalized in some erroneous way, than the amount of data should not be affected by how you map it through ORM. Perhaps the database architecture needs to be re-evaluated. Can you give an example of why you think you will have a larger size of data and negative performance impact if you choose option 1?

Option 2 sounds like you are asking for trouble. Perhaps it's the way you described it, but it seems to me you are proposing to introduce another data translation layer in your code.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic