I found this somewhere on the forum, but no replies to his request:
http://forum.hibernate.org/viewtopic.ph ... columnname
SessionFactory factory = session.getSessionFactory();
ClassMetadata metaData = factory.getClassMetadata(Customer.class);
BasicEntityPersister persister = (BasicEntityPersister)metaData;
String[] columns = persister.toColumns("creationDate");
for(int i=0;i<columns.length;i++){
this._logger.info("column name "+columns[i]);
}
It seems to work, can somebody explain me why I have to downcast to the BasicEntityPersister, why not promote the toColumns to the metaData? Would be more obious imho.