Spring Roo 1.2.5 + Oracle数据库= ORA-00902:数据类型无效

时间:2014-09-11 00:50:48

标签: oracle spring-roo

使用Oracle 11g Express Edition 11.2.0.2.0数据库,我有一个使用以下Roo脚本的简单项目:

// Spring Roo 1.2.5.RELEASE [rev 8341dc2] log opened at 2014-09-10 17:06:13
project --topLevelPackage com.example --java 7 --packaging jar --projectName TestBug
jpa setup --provider HIBERNATE --database ORACLE --hostName 192.168.3.44
// Edits to database.properties to allow access to Oracle XE 
entity jpa --class ~.domain.AbstractTestClass --abstract
field string --fieldName stringName
entity jpa --class ~.domain.ConcreteTestClass --extends ~.domain.AbstractTestClass --testAutomatically 
// Test succeeds
perform test
field boolean --fieldName testField
// Test fails
perform test

测试失败会导致以下错误:

HHH000389: Unsuccessful: create table abstract_test_class (dtype varchar2(31) not null, id 
number(19,0) not null, string_name varchar2(255), version number(10,0), monkey boolean, primary
key (id)) 2014-09-10 17:24:36,534 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - 
ORA-00902: invalid datatype

这是使用create-drop的“hibernate.hbm2ddl.auto”设置,并确保数据库在测试运行时是干净的。

在这种情况下是否应该使用除布尔值之外的数据类型?

1 个答案:

答案 0 :(得分:1)

解决这个问题的简单方法是在属性上指定最终的列类型:

   @Column(columnDefinition="NUMBER(1)")
   private boolean testField;

我找到a bug on hibernate-jira about it但仍未解决。

祝你好运!