I'm using Hibernate and I need to f开发者_开发技巧ind a way of retrieving the relations for an object dynamically at run-time. I can't find this in the API.
Can anyone point me in the right direction?
My best recommendation is to use plain JDBC DatabaseMetaData
DatabaseMetaData.getCrossReference
DatabaseMetaData.getImportedKeys
DatabaseMetaData.getExportedKeys
Examples
What You look for is SessionFactory's getClassMetadata() method. It returns ClassMetadata object describing given entity.
精彩评论