Determining ManyToMany vs OneToMany using ClassMetadata
问题 I am using ClassMetadata to determine the structure of a hibernate POJO. I need to determine if a collection is OneToMany or ManyToMany. Where is this information? Can I get to it without using reflection? See my code below. //Get the class' metadata ClassMetadata cmd=sf.getClassMetadata(o.getClass()); for(String propertyName:cmd.getPropertyNames()){ if (cmd.getPropertyType(propertyName).isCollectionType() && cmd.??()) //Do something with @ManyToMany collections. } All I need is method to