org.springframework.orm.hibernate3.HibernateQueryException: test4 is not mapped. [from test4 where status=1]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: test4 is not mapped. [from test4 where status=1]test4这张表
create table TEST4
(
  OPERATOR_ID NUMBER not null,
  NAME        VARCHAR2(400),
  PASSWORD    VARCHAR2(400),
  STATUS      NUMBER(1)
)用hibernate生成的XML会生成两个java
package com.t.bean;/**
 * Test4 entity.
 * 
 * @author MyEclipse Persistence Tools
 */public class Test4 implements java.io.Serializable { // Fields private Test4Id id; // Constructors /** default constructor */
public Test4() {
} /** full constructor */
public Test4(Test4Id id) {
this.id = id;
} // Property accessors public Test4Id getId() {
return this.id;
} public void setId(Test4Id id) {
this.id = id;
}}package com.t.bean;/**
 * Test4Id entity.
 * 
 * @author MyEclipse Persistence Tools
 */public class Test4Id implements java.io.Serializable { // Fields private Long operatorId;
private String name;
private String password;
private Long status; // Constructors /** default constructor */
public Test4Id() {
} /** minimal constructor */
public Test4Id(Long operatorId) {
this.operatorId = operatorId;
} /** full constructor */
public Test4Id(Long operatorId, String name, String password, Long status) {
this.operatorId = operatorId;
this.name = name;
this.password = password;
this.status = status;
} // Property accessors public Long getOperatorId() {
return this.operatorId;
} public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
} public String getName() {
return this.name;
} public void setName(String name) {
this.name = name;
} public String getPassword() {
return this.password;
} public void setPassword(String password) {
this.password = password;
} public Long getStatus() {
return this.status;
} public void setStatus(Long status) {
this.status = status;
} public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof Test4Id))
return false;
Test4Id castOther = (Test4Id) other; return ((this.getOperatorId() == castOther.getOperatorId()) || (this
.getOperatorId() != null
&& castOther.getOperatorId() != null && this.getOperatorId()
.equals(castOther.getOperatorId())))
&& ((this.getName() == castOther.getName()) || (this.getName() != null
&& castOther.getName() != null && this.getName()
.equals(castOther.getName())))
&& ((this.getPassword() == castOther.getPassword()) || (this
.getPassword() != null
&& castOther.getPassword() != null && this
.getPassword().equals(castOther.getPassword())))
&& ((this.getStatus() == castOther.getStatus()) || (this
.getStatus() != null
&& castOther.getStatus() != null && this.getStatus()
.equals(castOther.getStatus())));
} public int hashCode() {
int result = 17; result = 37
* result
+ (getOperatorId() == null ? 0 : this.getOperatorId()
.hashCode());
result = 37 * result
+ (getName() == null ? 0 : this.getName().hashCode());
result = 37 * result
+ (getPassword() == null ? 0 : this.getPassword().hashCode());
result = 37 * result
+ (getStatus() == null ? 0 : this.getStatus().hashCode());
return result;
}}test4.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 Persistence Tools
-->
<hibernate-mapping>
    <class name="com.t.bean.Test4" table="TEST4" schema="JTB">
        <composite-id name="id" class="com.t.bean.Test4Id">
            <key-property name="operatorId" type="java.lang.Long">
                <column name="OPERATOR_ID" precision="22" scale="0" />
            </key-property>
            <key-property name="name" type="java.lang.String">
                <column name="NAME" length="400" />
            </key-property>
            <key-property name="password" type="java.lang.String">
                <column name="PASSWORD" length="400" />
            </key-property>
            <key-property name="status" type="java.lang.Long">
                <column name="STATUS" precision="1" scale="0" />
            </key-property>
        </composite-id>
    </class>
</hibernate-mapping> 应该怎么用?