Object-to-relational maps are nowadays routinely utilized in providing a persistency mechanism for object-oriented programs. We present how an object-to-relational mapper, such as Hibernate, provides transparent persistency to object-oriented programs. We then show how the existing approaches of eager and lazy fetching of associations are problematic under the face of program evolution. As an improvement, we present selfconfiguring components, which reflectively configure the persistency layer usage sites, thus leading to improved maintainability of software.A self-configuring component analyses the actual persistency layer usage pattern. Based on this information, the actual queries are configured. A general algorithm for retrieving the actual usage pattern is given. As an implementation mechanism, we discuss different approaches for the self-configuring components. Practical choices for implementation can vary between analysis of abstract syntax trees and Java byte-code analysis. Suitability of two byte-code analysis frameworks, namely BCEL and Soot are evaluated.