myeclipse5.1+Eclipse3.2操作oracle中clob字段求助??
本人用 eclipse3.2+myeclipse5.1GA(hibernate3.0)连接oracle写clob字段:
数据库中的表(content)中有两个字段:id(int),content(clob),
生成bean文件时:有两个文件产生了:content.java和contentid.java
和Content.hbm.xml
content.java
package cn.fusion.beans;
/**
* Content generated by MyEclipse - Hibernate Tools
*/
public class Content implements java.io.Serializable {
// Fields
private ContentId id;
// Constructors
/** default constructor */
public Content() {
}
/** full constructor */
public Content(ContentId id) {
this.id = id;
}
// Property accessors
public ContentId getId() {
return this.id;
}
public void setId(ContentId id) {
this.id = id;
}
}
-----------------
contentid.java
package cn.fusion.beans;
/**
* ContentId generated by MyEclipse - Hibernate Tools
*/
public class ContentId implements java.io.Serializable {
// Fields
private Long id;
private String content;
// Constructors
/** default constructor */
public ContentId() {
}
/** minimal constructor */
public ContentId(Long id) {
this.id = id;
}
/** full constructor */
public ContentId(Long id, String content) {
this.id = id;
this.content = content;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getContent() {
return this.content;
} public void setContent(String content) {
this.content = content;
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof ContentId) ) return false;
ContentId castOther = ( ContentId ) other;
return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) )
&& ( (this.getContent()==castOther.getContent()) || ( this.getContent()!=null && castOther.getContent()!=null && this.getContent().equals(castOther.getContent()) ) );
}
public int hashCode() {
int result = 17;
result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() );
result = 37 * result + ( getContent() == null ? 0 : this.getContent().hashCode() );
return result;
}
}
--------------------------------
Content.hbm.xml
Content.hbm.xml
<?xml version= "1.0 " encoding= "utf-8 "?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN "
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd ">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name= "cn.fusion.beans.Content " table= "CONTENT " schema= "TZGA ">
<composite-id name= "id " class= "cn.fusion.beans.ContentId ">
<key-property name= "id " type= "java.lang.Long ">
<column name= "ID " precision= "22 " scale= "0 " />
</key-property>
<key-property name= "content " type= "java.lang.String ">
<column name= "CONTENT " />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
我前几次成表bean文件时都是只有一个java文件的,这次一下生成两个了,觉得有点奇怪,另外用保存那些普通字段的方法肯定是保存不了clob字段,请高手帮忙调试下啊:::
[解决办法]
生成的hibernate的两个JAVA文件是需要修改的,去掉那个抽象类,用contentid.java中的内容覆盖
content.java中的类......
[解决办法]
我给你消息了,看了之后还不明白的话,给我消息!