<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/Sales
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">MySql</property>
<property name="connection.password">ok</property>
<property name="connection.driver_class">
org.gjt.mm.mysql.Driver
</property>
<property name="show_sql">true</property>
<mapping resource="com/fund/to/FinancialAccount.hbm.xml" />
<mapping resource="com/fund/to/Sales.hbm.xml" />
<mapping resource="com/fund/to/Fund.hbm.xml"></mapping> </session-factory></hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/Sales
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">MySql</property>
<property name="connection.password">ok</property>
<property name="connection.driver_class">
org.gjt.mm.mysql.Driver
</property>
<property name="show_sql">true</property>
<mapping resource="com/fund/to/FinancialAccount.hbm.xml" />
<mapping resource="com/fund/to/Sales.hbm.xml" />
<mapping resource="com/fund/to/Fund.hbm.xml"></mapping> </session-factory></hibernate-configuration>
解决方案 »
- 马上毕业 给自己一个目标了 有经验的帮忙指正一下
- OpenSessionInViewFilter在Web Services中如何生效?
- 请教关于定时触发的问题
- 在web service中发邮件为什么不可以设置邮件主题及中文乱码
- S2SH 整合cxf
- 公司要出活 急!!
- hibernate怎么操作oracle10g中的BLOB字段啊?
- WebService 如何进行初始化???
- 大家在用java做生成excel报表时时怎么做的。
- org.springframework.beans.factory.BeanCreationException异常
- Hibernate Question:A Entity of Detached to Persistent ?
- struts的问题
<!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.fund.to.Fund" table="fund" catalog="sales">
<id name="fundNo" type="java.lang.Integer">
<column name="FUND_NO" />
<generator class="increment" />
</id>
<property name="fundName" type="java.lang.String">
<column name="FUND_NAME" length="40" />
</property>
<property name="price" type="java.lang.Double">
<column name="PRICE" precision="10" />
</property>
<property name="description" type="java.lang.String">
<column name="DESCRIPTION" length="100" />
</property>
<property name="status" type="java.lang.String">
<column name="STATUS" length="50" />
</property>
<property name="createdDate" type="java.util.Date">
<column name="CREATED_DATE" length="10" />
</property>
</class>
</hibernate-mapping>
类型转换失败,看你插入数据的时候类型是否正确。
* Fund generated by MyEclipse Persistence Tools
*/public class Fund implements java.io.Serializable { // Fields private Integer fundNo; private String fundName; private Double price; private String description; private String status; private Date createdDate; // Constructors /** default constructor */
public Fund() {
} /** full constructor */
public Fund(String fundName, Double price, String description,
String status, Date createdDate) {
this.fundName = fundName;
this.price = price;
this.description = description;
this.status = status;
this.createdDate = createdDate;
} // Property accessors public Integer getFundNo() {
return this.fundNo;
} public void setFundNo(Integer fundNo) {
this.fundNo = fundNo;
} public String getFundName() {
return this.fundName;
} public void setFundName(String fundName) {
this.fundName = fundName;
} public Double getPrice() {
return this.price;
} public void setPrice(Double price) {
this.price = price;
} public String getDescription() {
return this.description;
} public void setDescription(String description) {
this.description = description;
} public String getStatus() {
return this.status;
} public void setStatus(String status) {
this.status = status;
} public Date getCreatedDate() {
return this.createdDate;
} public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}}
第二个已经找到原因,是在生成映射文件的时候
<property name="price" type="java.lang.Double">
<column name="PRICE" precision="10" />
</property>
这个出了问题,不知道怎么解决
这个属性在mysql数据库里是decimal(10,2)类型
<column name="PRICE" length="10" />
</property>