Hello everyone,
If I do not know the database structure, Can I use hibernate read the database dictionary?
I want to read the tables' name and fields' name. Does anybody know how can I do this, thanks.
And I find the following code, but the table iterator is empty(In fact, there are three tables)
Code:
Configuration cfg = new Configuration().configure(new File("D:\\hibernate.cfg.xml"));
for (Iterator iter = cfg.getTableMappings(); iter.hasNext();) {
Table table = (Table) iter.next();
for (Iterator iterator = table.getColumnIterator(); iterator
.hasNext();) {
Column column = (Column) iterator.next();
System.out.println(column.getName());
}
}
Thanks to everyone.