Hibernate - 映射:无法确定 # 的类型,在表:#,对于列:#

我尝试了一切,但我被卡住了。你能帮我吗?


小项目只是对大数据库的初步测试。我只使用了一个星期的 Hibernate,稍后我试图将它与 Srping MVC Tomcat 连接起来。


但现在我只想能够识别映射中的错误。


安慰:


    `Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: hiber.data_examplecompany.Address, at table: EMPLOYEE, for columns: [org.hibernate.mapping.Column(address)]

Exception in thread "main" java.lang.ExceptionInInitializerError

    at tools.hiber.HiberUtil.<clinit>(HiberUtil.java:19)

    at tools.hiber.HiberSave.main(HiberSave.java:15)

Caused by: org.hibernate.MappingException: Could not determine type for: hiber.data_examplecompany.Address, at table: EMPLOYEE, for columns: [org.hibernate.mapping.Column(address)]

    at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:486)

    at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:453)

    at org.hibernate.mapping.Property.isValid(Property.java:226)

    at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:624)

    at org.hibernate.mapping.RootClass.validate(RootClass.java:267)

    at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:347)

    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:466)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)

    at tools.hiber.HiberUtil.<clinit>(HiberUtil.java:15)

    ... 1 more

员工.java:


package hiber.data_examplecompany;


import javax.persistence.Access;

import javax.persistence.AccessType;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.OneToOne;

import javax.persistence.Table;


import org.hibernate.annotations.Cascade;


@Entity

@Table(name = "EMPLOYEE")

@Access(value=AccessType.FIELD)


小唯快跑啊
浏览 120回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java