Hibernate Configuration with No XML
Filed in archive Programming on November 27, 2005

Click to enlargeThis is something I'm not sure everyone knows because I've searched a number of tutorials on the subject and not found anything. Additionally I'm not a big fan of XML configuration files unless they are absolutely required. Spring seems to be the exception to that rule for me since the drudgery involved in the XML configuration of it has such a large return on the time invested.
Anyway, Someone helped me with this the other day. I had been spending a lot of time getting my Hibernate configuration file working the way I wanted. After I finished an associate forwarded me a sample of some code they were working on and I thought it was pretty cool. I then rewrote my configuration file as properties in a Java class and like it with the hibernate configuration in a Java class. With this configuration and XDoclet there is no need to write any XML when using Hibernate at all.
I'm sure there are developers out there that like using XML instead but this is one more option. Changes would require a recompile... obviously. However, a change to an XML file would require an application to be restarted, which is much less severe but would affect the user experience as well. I guess it all depends on individual developers preferences and their like or dislike of XML configuration files.
Permalink: Hibernate Configuration with No XML
Tags: Hibernate XML
Vote for Hibernate Configuration with No XML:
|
Rating: 4.40 out of 5 vote(s) cast.
|
Response from:
afisna
(11/27/05 6:41pm)
Actually with IDEA, xml configurations are very easy. i never felt bad or understand the fuss about it. it helps greately (automatic formatting, automatic verification, class-tag-attribute sensing while writing etc..) posibly you are not using it right? anyway, it was a nice tip. thanks.
Response from:
Jason
(11/27/05 7:45pm)
Afisna,
Thanks for the feedback. I do use IntelliJ but have not played with anything special as far as XML goes. At the moment I'm using version 4.* so maybe what your talking about is in v5 I'm not sure. In any case this is just one option. If it came down to it and I had to use an XML configuration file I would.
Jason
Thanks for the feedback. I do use IntelliJ but have not played with anything special as far as XML goes. At the moment I'm using version 4.* so maybe what your talking about is in v5 I'm not sure. In any case this is just one option. If it came down to it and I had to use an XML configuration file I would.
Jason
| RSS | |
|
| |
| Yahoo! |
|
| Addthis |
|
| Bloglines |
|
| Follow us on Twitter! |
Most Popular
AJAX
Application Development
Awards
Basics
Best of
Business
conference
Did you know
E-Commerce
Information About
Management
Misc
Mobile Devices
mobile phones
Monthly Contest
Personal
Programming
Quick introduction
Security
Service Oriented Architectures
