• 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

Hibernate with xml files

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Do you know if Hibernate can be used with XML files, not with database ? I mean the source is not a SGBD (Mysql, Oracle, DB2, etc), but the data is stored in xml file ?
I have found a JDBC Driver for XML files here: http://www.theserverside.com/news/thread.tss?thread_id=43395, but I cannot see how I can use Hibernate with that.
Do you know anything about this ?

Thank you
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes , This is very good question from you. I am keen interest to know this answer. If you got answer from any other sources , please post your message.
 
camelia codarcea
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This Driver is called "StelsXML", but as I see, it is not free, you can only get trial version.
 
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
Hibernate is specifically for relational databases. If you can find something else that gives you access to file based data via a JDBC driver then it might work, though you will probably have to write your own Dialect. There are some projects out there that try to do this, for example ODA.

Any reason why you can't just use something like JAXB?
 
camelia codarcea
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

Thank you for responding. The idea was that for the moment(a prototype) the data we work with is stored in xml files, but later on the data will be stored in database. And I thought that it would be easier just to change the hibernate configuration file to change it form xml files to database mapping. but if I have to write my own Dialect to do that.. then I better quit this idea.
 
Paul Sturrock
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
Its a decent enough idea; if you access your data via a DAO pattern you can still swap the underlying implementation. OK, not as basic as just changing a hibernate configuration file, but when you make your change the impact on the business code should be negligable.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually Hibernate does have mapping to xml files, it was an "experimental" feature.

http://www.hibernate.org/hib_docs/v3/reference/en/html/xml.html

Now personally, I would use JAXB myself, but if you want to map to both database and xml, then it might be nice to use one api/product for it.

Mark
[ May 23, 2008: Message edited by: Mark Spritzler ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic