The hibernate.cfg.xml configuration file must be on the application classpath to be automatically detected by Hibernate at startup. Placing it in the source directory ensures it gets copied to the classpath root during compilation. Lib directories are for JAR dependencies, not configuration files.