我試圖讓我的事務類的SQL查詢(春季註釋)的結果:Hibernate沒有找到一個屬性(org.hibernate.PropertyNotFoundException)二傳手
String query = "SELECT DAT, DROP_RADIO FROM My_TABLE";
SQLQuery q = getCurrentSession().createSQLQuery(query);
q.setResultTransformer(Transformers.aliasToBean(CallDrop.class));
List result = q.list();
而且CallDrop:
public class CallDrop implements java.io.Serializable {
private int id;
private Date dat;
private BigDecimal onRadio;
public BigDecimal getOnRadio() {
return onRadio;
}
public void setOnRadio(BigDecimal onRadio) {
this.onRadio = onRadio;
}
public Date getDat() {
return dat;
}
public void setDat(Date dat) {
this.dat = dat;
}
}
的的.hbm.xml是:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.company.beans.CallDrop" table="My_TABLE">
<id name="id" type="int" />
<property name="dat" type="date">
<column name="DAT" length="10" />
</property>
<property name="onRadio" type="big_decimal">
<column name="DROP_RADIO" precision="22" scale="0" />
</property>
</class>
</hibernate-mapping>
我敢肯定,我已經添加了的hbm.xml到ApplicationContext的文件中,會話工廠:
<bean id="sessionFactoryETL" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSourceETL"/></property>
<property name="mappingResources">
<list>
<value>com/company/beans/CallDrop.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
所以,沒有類型,但它不起作用。有沒有人知道問題是什麼? 感謝
你映射到kpi_network_bh和查詢過My_Table.Is它是錯誤的? –
這只是一個錯誤時發佈 –
@ DonRoby它是一個新的功能在計算器:) –