JPA映射文件jpa.reveng.xml的配置问题

JAP映射oracle 表时,因为字段类型是number, 所以生成的对象是BigDECIMAL,如果想类型是:java.util.Long 的话就必须修改配置文件如下:

<sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Long"></sql-type>

 

下面是oracle的JDBC-type与数据库字段类型之间的关系。

 

ARRAYBLOBWill be read back as BLOB
BIGINTNUMBER(38) 
BINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is used.
Will be read back as VARBINARY
BITNUMBER(1)Oracle has no native boolean type.
BLOBBLOB 
BOOLEANNUMBER(1)Oracle has no native boolean type.
Will be read back as BIT
CHARCHAR 
CLOBCLOB 
DATALINKBLOBWill be read back as BLOB
DATEDATE 
DECIMALNUMBER 
DISTINCTBLOBWill be read back as BLOB
DOUBLEDOUBLE PRECISION 
FLOATFLOATWill be read back as DOUBLE
INTEGERINTEGER 
JAVA_OBJECTBLOBWill be read back as BLOB
LONGVARBINARYBLOBWill be read back as BLOB
LONGVARCHARCLOBWill be read back as CLOB
NULLBLOBWill be read back as BLOB
NUMERICNUMBERWill be read back as DECIMAL
OTHERBLOBWill be read back as BLOB
REALREAL 
REFBLOBWill be read back as BLOB
SMALLINTNUMBER(5) 
STRUCTBLOBWill be read back as BLOB
TIMEDATEWill be read back as TIMESTAMP
TIMESTAMPOracle8 platform: DATE
Oracle9/10 platforms: TIMESTAMP
The TIMESTAMP native type is only supported in Oracle 9 and above.
TINYINTNUMBER(3) 
VARBINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is
ARRAYBLOBWill be read back as BLOB
BIGINTNUMBER(38) 
BINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is used.
Will be read back as VARBINARY
BITNUMBER(1)Oracle has no native boolean type.
BLOBBLOB 
BOOLEANNUMBER(1)Oracle has no native boolean type.
Will be read back as BIT
CHARCHAR 
CLOBCLOB 
DATALINKBLOBWill be read back as BLOB
DATEDATE 
DECIMALNUMBER 
DISTINCTBLOBWill be read back as BLOB
DOUBLEDOUBLE PRECISION 
FLOATFLOATWill be read back as DOUBLE
INTEGERINTEGER 
JAVA_OBJECTBLOBWill be read back as BLOB
LONGVARBINARYBLOBWill be read back as BLOB
LONGVARCHARCLOBWill be read back as CLOB
NULLBLOBWill be read back as BLOB
NUMERICNUMBERWill be read back as DECIMAL
OTHERBLOBWill be read back as BLOB
REALREAL 
REFBLOBWill be read back as BLOB
SMALLINTNUMBER(5) 
STRUCTBLOBWill be read back as BLOB
TIMEDATEWill be read back as TIMESTAMP
TIMESTAMPOracle8 platform: DATE
Oracle9/10 platforms: TIMESTAMP
The TIMESTAMP native type is only supported in Oracle 9 and above.
TINYINTNUMBER(3) 
VARBINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is
ARRAYBLOBWill be read back as BLOB
BIGINTNUMBER(38) 
BINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is used.
Will be read back as VARBINARY
BITNUMBER(1)Oracle has no native boolean type.
BLOBBLOB 
BOOLEANNUMBER(1)Oracle has no native boolean type.
Will be read back as BIT
CHARCHAR 
CLOBCLOB 
DATALINKBLOBWill be read back as BLOB
DATEDATE 
DECIMALNUMBER 
DISTINCTBLOBWill be read back as BLOB
DOUBLEDOUBLE PRECISION 
FLOATFLOATWill be read back as DOUBLE
INTEGERINTEGER 
JAVA_OBJECTBLOBWill be read back as BLOB
LONGVARBINARYBLOBWill be read back as BLOB
LONGVARCHARCLOBWill be read back as CLOB
NULLBLOBWill be read back as BLOB
NUMERICNUMBERWill be read back as DECIMAL
OTHERBLOBWill be read back as BLOB
REALREAL 
REFBLOBWill be read back as BLOB
SMALLINTNUMBER(5) 
STRUCTBLOBWill be read back as BLOB
TIMEDATEWill be read back as TIMESTAMP
TIMESTAMPOracle8 platform: DATE
Oracle9/10 platforms: TIMESTAMP
The TIMESTAMP native type is only supported in Oracle 9 and above.
TINYINTNUMBER(3) 
VARBINARYRAWOracle requires the specification of the size for RAW columns. If no size was specified, then 254 is
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE hibernate-reverse-engineering   
  3.   SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >  
  4.   
  5. <hibernate-reverse-engineering>  
  6.   
  7.     <type-mapping>  
  8.         <!-- jdbc-type is name fom java.sql.Types -->  
  9.         <sql-type jdbc-type="VARCHAR" length='1' hibernate-type="yes_no"/>  
  10.         <!-- length, scale and precision can be used to specify the mapping precisly -->  
  11.         <sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="boolean"/>  
  12.         <!-- the type-mappings are ordered. This mapping will be consulted last,   
  13.         thus overriden by the previous one if precision=1 for the column -->  
  14.         <sql-type jdbc-type="BIGINT" hibernate-type="java.lang.Long"/>  
  15.         <sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Long"/>  
  16.         <sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long"/>  
  17.     </type-mapping>  
  18.   
  19.     <!-- BIN$ is recycle bin tables in Oracle -->  
  20.     <table-filter match-name="BIN$.*" exclude="true"/>  
  21.   
  22.     <!-- Exclude AppFuse tables from all catalogs/schemas -->  
  23.     <!-- 按表名过滤表 -->  
  24.     <table-filter match-name="app_user" exclude="true"/>  
  25.     <table-filter match-name="role" exclude="true"/>  
  26.     <table-filter match-name="user_role" exclude="true"/>  
  27.        
  28. </hibernate-reverse-engineering>  
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值