hibernate 操作视图
package com.pure.bean;
/**
* VNews generated by MyEclipse - Hibernate Tools
*/
public class VNews implements java.io.Serializable {
// Fields
private VNewsId id;
// Constructors
/** default constructor */
public VNews() {
}
/** full constructor */
public VNews(VNewsId id) {
this.id = id;
}
// Property accessors
public VNewsId getId() {
return this.id;
}
public void setId(VNewsId id) {
this.id = id;
}
}
package com.pure.bean;
/**
* VNewsId generated by MyEclipse - Hibernate Tools
*/
public class VNewsId implements java.io.Serializable {
// Fields
private long id;
private String newstitle;
private String newsauthor;
// Constructors
/** default constructor */
public VNewsId() {
}
/** minimal constructor */
public VNewsId(long id) {
this.id = id;
}
// Property accessors
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public String getNewstitle() {
return this.newstitle;
}
public void setNewstitle(String newstitle) {
this.newstitle = newstitle;
}
public String getNewsauthor() {
return this.newsauthor;
}
public void setNewsauthor(String newsauthor) {
this.newsauthor = newsauthor;
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof VNewsId) ) return false;
VNewsId castOther = ( VNewsId ) other;
return (this.getId()==castOther.getId())
&& ( (this.getNewstitle()==castOther.getNewstitle()) || ( this.getNewstitle()!=null && castOther.getNewstitle()!=null && this.getNewstitle().equals(castOther.getNewstitle()) ) )
&& ( (this.getNewsauthor()==castOther.getNewsauthor()) || ( this.getNewsauthor()!=null && castOther.getNewsauthor()!=null && this.getNewsauthor().equals(castOther.getNewsauthor()) ) );
}
public int hashCode() {
int result = 17;
result = 37 * result + (int) this.getId();
result = 37 * result + ( getNewstitle() == null ? 0 : this.getNewstitle().hashCode() );
result = 37 * result + ( getNewsauthor() == null ? 0 : this.getNewsauthor().hashCode() );
return result;
}
}
<?xml version="1.0"?>
<!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="com.pure.bean.VNews" table="V_NEWS" schema="CMDBUSER">
<composite-id name="id" class="com.pure.bean.VNewsId">
<key-property name="id" type="int">
<column name="ID" precision="11" />
</key-property>
<key-property name="newstitle" type="string">
<column name="NEWSTITLE" length="50" />
</key-property>
<key-property name="newsauthor" type="string">
<column name="NEWSAUTHOR" length="30" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
当执行session.createquery("from VNews ")时总报VNews 没有被映射。
求各位帮小弟。