########################################
Customer.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-mapping>
<class name="hibernate3.Customer" table="Customer" proxy="Customer"> <id name="id" column="id">
<generator class="increment"/>
</id> <property name="username" column="username" />
<property name="password" column="password" /> </class>
</hibernate-mapping>中的
<property name="username" column="username" />
<property name="password" column="password" />
改成
<property name="username">
<column name="username"/>
</property>
<property name="password">
<column name="password"/>
</property>试一下
Customer.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-mapping>
<class name="hibernate3.Customer" table="Customer" proxy="Customer"> <id name="id" column="id">
<generator class="increment"/>
</id> <property name="username" column="username" />
<property name="password" column="password" /> </class>
</hibernate-mapping>中的
<property name="username" column="username" />
<property name="password" column="password" />
改成
<property name="username">
<column name="username"/>
</property>
<property name="password">
<column name="password"/>
</property>试一下
解决方案 »
- Struts2 怎样通过url访问父Action的方法
- 关于javaWeb
- 应用程序迁移到was 6.1.21后,应用出错
- 要做个备份数据功能,有问题求教
- hibernate多对一关联,查询出来的结果中有SET集合如何处理
- STRUTS 中的 html:form 需要其他的ActionMappings or ActionFormBeans collection吗?
- 用java如何将数据库中的数据快速导出到excel
- logic:iterate的用法请教,测试了一个下午都没有搞定!谢谢先!
- javamail问题: 该段程序无法发送给Hotmail的用户
- Java连接SQL Server出现错误,求指教
- java bean中如何实现两个日期的差值
- 在java里怎么调用c#写的web服务
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >映射文件应该用hibernate-mapping-3.0.dtd
WARN SettingsFactory:103 - Could not obtain connection metadata
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:371)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
......
org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
....
Caused by: java.sql.SQLException: Network error IOException: Connection refused: connect
....
Caused by: java.net.ConnectException: Connection refused: connect
到底哪里有错?还请各位帮忙!
jdbc:jtds:sqlserver://localhost:1433/yufan;
</property><property name="hibernate.connection.driver_class">
net.sourceforge.jtds.jdbc.Driver
</property>改成
<property name="hibernate.connection.url">
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=yufan
</property><property name="hibernate.connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>试试,我这里没有mssql,不能试呀
e-mail: [email protected]
java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:95)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory
.....
WARN PojoEntityTuplizer:167 - could not create proxy factory for:hibernate3.Customer
org.hibernate.HibernateException: CGLIB Enhancement failed: hibernate3.Customer
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:106)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate
.....
avax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)请各位指导!
将这个包加入倒你测classpath就行了