为什么Hibernate切换到CLOB使用LONG? [英] Why has Hibernate switched to use LONG over CLOB?
问题描述
LONG
数据类型而不是 CLOB code>为code> type =text
。 这会导致问题,因为<$ Oracle中的c $ c> LONG 数据类型是旧的过时数据类型(请参见 http://www.orafaq.com/wiki/LONG )不应该被使用,并且表格不能有多于一列,其中 LONG
作为数据类型。
有人知道为什么这个已经改变了吗?
我试图设置Oracle SetBigStringTryClob
属性为true(如 Hibernate> CLOB > Oracle :( ),但这并不影响数据类型映射,但只影响与我的案例无关的数据传输内部消息。
一种可能的修复因为这是重写 org.hibernate.dialect.Oracle9iDialect
:
public class Oracle9iDialectFix扩展了Oracle9iDialect {
public Oracle9iDialectFix(){
super();
registerColumnType(Types.LONGVARCHAR,clob);
registerColumnType(Types.LONGNVARCHAR,clob);
}
}
然而这是最后的手段 - 覆盖这个类是更接近分叉Hibernate,我宁愿避免这样做。
任何人都可以解释为什么这样做了吗?
这是否应该作为bug提出?
[UPDATE]:我创建了 http://opensource.atlassian.com/projects/hibernate/browse/HHH-5569 ,让我们看看会发生什么。
看起来这个问题的解决方案是使用 materialized_clob
,至少这就是由Gail Badner在 HHH-5569 上说。
这完全没有帮助我(我留下了相关评论),但可能对此处的其他人有所帮助。无论如何,该错误被拒绝,我可以做的事情很少,但使用重叠方言:($ / b $ b
It looks like that Hibernate started using LONG
data type in version 3.5.5 (we upgraded from 3.2.7) instead of CLOB
for the property of type="text"
.
This is causing problems as LONG
data type in Oracle is an old outdated data type (see http://www.orafaq.com/wiki/LONG) that shouldn’t be used, and tables can’t have more than one column having LONG
as a data type.
Does anyone know why this has been changed?
I have tried to set the Oracle SetBigStringTryClob
property to true (as suggested in Hibernate > CLOB > Oracle :(), but that does not affect the data type mapping but only data transfer internals which are irrelevant to my case.
One possible fix for this is to override the org.hibernate.dialect.Oracle9iDialect
:
public class Oracle9iDialectFix extends Oracle9iDialect {
public Oracle9iDialectFix() {
super();
registerColumnType(Types.LONGVARCHAR, "clob");
registerColumnType(Types.LONGNVARCHAR, "clob");
}
}
However this is the last resort - overriding this class is step closer to forking Hibernate which I would rather avoid doing.
Can anybody explain why this was done? Should this be raised as a bug?
[UPDATE]: I have created http://opensource.atlassian.com/projects/hibernate/browse/HHH-5569, let's see what happens.
It looks like the resolution to this issue is to use materialized_clob
, at least that's what's being said by Gail Badner on HHH-5569.
This doesn't help me at all (and I left relevant comment about that) but might be helpful for someone else here. Anyway the bug is rejected and there is very little I can do about it but use overriden dialect :(
这篇关于为什么Hibernate切换到CLOB使用LONG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!