org.hibernate.MappingException: Could not determine type for: java.util.List, at table: user, for...

时间:2022-04-10 15:03:10

异常详情:

Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: ss_user, for columns: [org.hibernate.mapping.Column(roles)]

    at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.mapping.Property.isValid(Property.java:241) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.mapping.RootClass.validate(RootClass.java:270) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) ~[hibernate-entitymanager-4.3.5.Final.jar:4.3.5.Final]

    ... 125 common frames omitted

解决的方法:

注解要么写在字段上,要么写在getXX上,千万千万不能混合使用,否则会报这个错误!