Good morning Stackoverflow,
I have the problem that it gives me the error:
Failed to create sessionFactory object.org.hibernate.AnnotationExcept
The Exception is straightforward and says : Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements, so the cause is obvious here and if we take a look at the Hibernate Collection mapping documentation it clearly states that:
As a requirement persistent collection-valued fields must be declared as an interface type (see Example 7.2, “Collection mapping using @OneToMany and @JoinColumn”). The actual interface might be
java.util.Set,java.util.Collection,java.util.List,java.util.Map,java.util.SortedSet,java.util.SortedMap...
And you used TreeSet which is an implementation class for both Set and SortedSet interfaces. So your actual mapping won't work with TreeSet, you should use a Set instead of a TreeSet:
private Set coachGroups = new HashSet();