`
googya
  • 浏览: 140931 次
  • 性别: Icon_minigender_1
  • 来自: 汉川
社区版块
存档分类
最新评论

Could not determine type for: String

    博客分类:
  • Java
阅读更多
初学hibernate,遇到这样一个问题。搞了半天都不知道问题出在哪儿,结果发现是配置文件中的类型写法出了问题。

Exception in thread "main" java.lang.ExceptionInInitializerError
at hib.HibernateUtil.<clinit>(HibernateUtil.java:21)
at hib.dynamicmodel.DynamicDemo.main(DynamicDemo.java:24)
Caused by: org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(name)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
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)



  <property name = "name" column="name" type = "string"/>


开始我写的是 type = "String",正确的因该是上面的,type = "string"
type指的是hibernate中的类型,不是java中的String类型,必须小写。

下面是Java类型,hibernate类型 sql类型对照表:



Hibernate映射类型对照表
java类型
Hibernate映射类型 SQL类型java.math.BigDecimal big_decimal numericbyte[] binary varbinary(blob)boolean(java.lang.Boolean) boolean bitbyte(java.lang.Byte) byte tinyintjava.util.Calendar calendar timestampjava.sql.Clob clob clobjava.util.Date 或java.sql.Date date datedouble(java.lang.Double) double doublefloat(java.lang.Float) float floatint (java.lang.Integer) integer integerjava.util.Local local varcharlong(java.lang.Long) long bigintjava.io.Serializable的某个实例 serializable varbinary(或blob)java.lang.String string varcharjava.lang.String text clobjava.util.Date 或 java.sql.Timestamp time timestamp

分享到:
评论

相关推荐

    LuaUnicode icu-lua

    Happily UTF-8 is designed so that it is relatively easy to count the number of unicode symbols in a string: simply count the number of octets that are in the ranges 0x00 to 0x7f (inclusive) or 0xC2 to...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    On the other hand, you must include the header file for Foo if your class subclasses Foo or has a data member of type Foo. Sometimes it makes sense to have pointer (or better, scoped_ptr) members ...

    acpi控制笔记本风扇转速

    Disassembler - fix for error emitted for unknown type for target of scope operator. Now, ignore it and continue. Disassembly of an FADT now verifies the input FADT and reports any errors found. Fix ...

    Chinese Entity Linking Comprehensive

    equivalence class clusters for NIL entities (those that could not be linked to an entity in the knowledge base), and entity type information for each of the queries. The data included in this ...

    Senfore_DragDrop_v4.1

    Delphi's THandle type when a HWND is passed to a function. E.g.: if (DragDetectPlus(THandle(MyControl-&gt;Handle), Point(X, Y))) { ... } * Virtual File Stream formats can only be pasted from the ...

    微软内部资料-SQL性能优化3

    To determine the transaction isolation level currently set, use the DBCC USEROPTIONS statement, for example: USE pubs GO SET TRANSACTION ISOLATION LEVEL REPEATABLE READ GO DBCC USEROPTIONS GO ...

    Bochs - The cross platform IA-32 (x86) emulator

    - Determine and select max physical address size automatically at configure time: - 32-bit physical address for 386/486 guests - 36-bit physical address for PSE-36 enabled Pentium guest - 40-bit ...

    php.ini-development

    An empty string can be denoted by simply not writing anything after the equal ; sign, or by using the None keyword: ; foo = ; sets foo to an empty string ; foo = None ; sets foo to an empty string ;...

    计算机网络第六版答案

    14. If the two ISPs do not peer with each other, then when they send traffic to each other they have to send the traffic through a provider ISP (intermediary), to which they have to pay for carrying ...

    数位板压力测试

    This specification was developed in response to a perceived need for a standardized programming inter-face to digitizing tablets, three dimensional position sensors, and other pointing devices by a ...

    雷达技术知识

    compared with field measurements to evaluate accuracies and determine how water surface roughness and point density affect LiDAR measurements. Results show that LiDAR derived water surface slopes were...

Global site tag (gtag.js) - Google Analytics