public Configuration getConfiguration() {
Configuration configuration = new Configuration();
setMappings(configuration);
Iterator classMappings = configuration.getClassMappings();
while (classMappings.hasNext()) {
PersistentClass cm = (PersistentClass) classMappings.next();
Iterator propertyIterator = cm.getPropertyIterator();
while (propertyIterator.hasNext()) {
Property element = (Property) propertyIterator.next();
//Logger.debug(cm.getEntityName() + " = " + element.getName());
Iterator columnIterator = element.getValue().getColumnIterator();
while (columnIterator.hasNext()) {
Column col = (Column) columnIterator.next();
//Logger.debug(col.getName() + " > " + col.getLength());
}
}
}
return configuration;
}
private void setMappings(Configuration configuration) {
String[] files = new String[] { "AvailabilityCode", "StateCode",
"StatusCode", "SuitabilityCode", "ReasonCode", "Property",
"PropertyHistory", "Publication", "Agency", "PasswordHistory",
"UnsuitableReason", "User", "PropertyNumberSequence",
"FieldOfficeCode", "FieldOfficePoc", "DodDepartment",
"BracApplication", "Contact", "ContactType" };
for (int i = 0; i <>
at 6/09/2006 05:25:00 PM2009年6月9日 星期二
Hibernate: Get Length and Type attribute from property on mapping file using JAVA
After get configuration, you can get length from property.
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言