log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.hibernate.MappingException: Could not determine type for: String, at table: Customer, for columns: [org.hibernate.mapping.Column(name)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:396)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:369)
at org.hibernate.mapping.Property.isValid(Property.java:225)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:529)
at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:443)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
at cn.com.pack.Demo.test(Demo.java:14)
at cn.com.pack.Demo.main(Demo.java:28)
解决方法:
type指的是hibernate中的类型,不是java中的String类型,必须小写,
这个是错误的
<property name="cust_name" column="name" length="255" type="String" />
这个是正确的
<property name="cust_name" column="name" length="255" type="string" />