我遇到了休眠問題。我最近設置了我的hbm2ddl進行驗證,並且一直在抱怨錯誤的數據類型。我已經修復了除布爾值之外的所有問題。用休眠映射布爾值
我有一個字段opener
在我的類,它被映射爲:
<property column="opener" name="opener" type="boolean"/>
列opener
是一個tinyint (4)
並具有到目前爲止,我已經試圖改變類型的1或0的值,但無濟於事。我也嘗試在我的hibernate.cfg中使用以下設置:
<property name="hibernate.query.substitutions">true 1, false 0</property>
但是我仍然收到相同的錯誤。我究竟做錯了什麼?
org.hibernate.HibernateException: Wrong column type: opener, expected: bit
at org.hibernate.mapping.Table.validateColumns(Table.java:261)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
注意:我沒有訪問數據庫的權限。
對不起,我必須有一個更清晰的狀態,但我沒有控制數據庫,它在OP中。 – Terraego 2011-05-31 18:06:46