Here since the column ="cname" is used twice one for the school and one for the grade, this error happens
Initial SessionFactory creation failed.org.hibernate.MappingException: Repeated column in mapping for entity: Student column: schoolname (should be mapped with insert="false" update="false")
Exception in thread "main" java.lang.ExceptionInInitializerError at HibernateUtil.<clinit>(HibernateUtil.java:41)
at Main.main(Main.java:20)
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: Student column: schoolname (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at HibernateUtil.<clinit>(HibernateUtil.java:37)
... 1 more
Java Result: 1