• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Concept of API's

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a concept question. A piece of software I am part of a development team on is having a slight problem, and I'm looking for some astute direction. The tools in question are Spring and Hibernate. We have an object mapped to a specific version of a database with hibernate. My reasoning is that when I pick up and object from that database, it should be the responsibility of the API to allow me to return that object to a different version of the database (some columns have been added), not the responsibility of the program retrieving and sending the object.

What is the wisdom at the Saloon on this topic?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are trying to do is possible. Using Hibernate you could happily retrieve an object from one data model version and store it in another, assuming any extra fields added to the table this object is mapped to are nullable, or use a DEFAULT constraint. You couldn't go the other way though, and remove fields from a table.

To do this you will need retrieve the object, switch SessionFactories, open a session and save the object.
[ September 13, 2005: Message edited by: Paul Sturrock ]
 
Carty Ellis
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to extend the object retrieved from deserialized in order to add a value to a new column if the new column is both "not nullable" and a default constraint is not appropriate? Then to open a new session and put out the object?
 
I think I'll just lie down here for a second. And ponder this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic