I need to get column names from a table, I referred this link here: http://www.kodejava.org/examples/163.html
It shows using jdbc to get the metadata, I want to know is there any hibernate method similar to this? I am having mysql and oracle as the databases.
You can use the following codes:
String[] columnNames = sessionFactory.getClassMetadata(Java.class).getPropertyNames();
Type[] columnTypes = sessionFactory().getClassMetadata(Java.class).getPropertyTypes();
String[] columnNames = getSessionFactory().getClassMetadata(Employee.class).getPropertyNames();
org.hibernate.type.Type[] columnTypes = getSessionFactory().getClassMetadata(Employee.class).getPropertyTypes();