It's not that simple, unfortunatelly. Your best bet to detect this is by checking for particular CollectionPersister
implementation:
SessionFactory sf = ...;
// Get the class' metadata
ClassMetadata cmd = sf.getClassMetadata(o.getClass());
for(String propertyName:cmd.getPropertyNames()) {
Type propertyType = cmd.getPropertyType(propertyName);
if (propertyType.isCollectionType()) {
CollectionType collType = (CollectionType) propertyType;
// obtain collection persister
CollectionPersister persister = ((SessionFactoryImplementor) sf)
.getCollectionPersister(collType.getRole());
if (persister instanceof OneToManyPersister) {
// this is one-to-many
} else {
// this is many-to-many OR collection of elements
}
} // if
} // for
ChssPly76
2009-09-03 18:36:56