• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate with xml files

 
camelia codarcea
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • 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
 
shankar reddy
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
This Driver is called "StelsXML", but as I see, it is not free, you can only get trial version.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic