It's a bit weird but it works:
ClassMetadata hibernateMetadata = sessionFactory.getClassMetadata(pClassName);
if (hibernateMetadata == null)
{
return;
}
if (hibernateMetadata instanceof AbstractEntityPersister)
{
AbstractEntityPersister persister = (AbstractEntityPersister) hibernateMetadata;
String tableName = persister.getTableName();
String[] columnNames = persister.getKeyColumnNames();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…