Hibernate的executeSQLQuery问题

用的hibernate版本是3。运行环境是jboss4+ejb2。
问题描述:普通的HQL没问题,通过执行executeSQLQuery,比如对应的SQL是
select c.xx1,c.xx2,a.xx1 from c,a on c.id = a.id
正常返回是Object[],这个Object[]长度为3.

    真实问题是:返回的是Object[],但是长度为0,直接抓狂。。。。。。

hibernate.cfg.xml:

HibernateSessionFactory
<!-- org.hibernate.hql.classic.ClassicQueryTranslatorFactory -->
java:jdbc/oracle
false
org.hibernate.dialect.OracleDialect
org.hibernate.transaction.JBossTransactionManagerLookup
org.hibernate.transaction.CMTTransactionFactory
50
50

    <property name="hibernate.transaction.auto_close_session">true</property>
    <property name="hibernate.transaction.flush_before_completion">false</property>
    <property name="hibernate.connection.release_mode">auto</property>
    <property name="hibernate.cache.use_second_level_cache">false</property>
    <property name="hibernate.cache.use_query_cache">false</property>
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>    

3个回答

查一下executeSQLQuery与executeQuery的区别

返回的是Object[],但是长度为0
有什么问题嘛,返回是长度为0,那就是没查询到数据呗

符合条件数据有2条,集合的size为2,但是集合中的Object[],但是长度为0。。。这才是最纠结的。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring jpa hibernate性能问题

使用spring jpa hibernate向mysql数据库中存储数据,发现插入一条数据耗时几十毫秒到几百毫秒,如何能够提高save性能,时间缩短至10毫秒以下。

eclipse +hibernate tools 问题

<p>为什么我的eclipse 3.4.2 + jdk 1.6.0_10 安装 hibernate 3.2.4 GA 后无法使用? <br>我将  hibernate 3.2.4 GA  解压后 将两个文件夹 复制到 eclipse中对应的文件夹,但是打开eclipse后,不显示</p> <p> ,no answer?</p><br /><strong>问题补充:</strong><br />说错了,就是hibernate tools 中的两个文件夹。plugins 和 features 复制到 eclipse3.4.2 中对应的文件夹后 打开eclipse 在新建 中,没有相关hibernate的选项。<br /><strong>问题补充:</strong><br /><img src="http://www.iteye.com/upload/attachment/112565/918ca10f-0530-34d7-81ee-d0a5aa0f935b.jpg" /> <br /> <br />还是不行,我把eclipse 3.4.2 删了,重新解压的,再复制进去也不行,是不是jdk1.6的事?<br /><strong>问题补充:</strong><br />jdk1.5 也不行了<br /><strong>问题补充:</strong><br />你用的eclipse版本多少?hibernate tools 版本多少?我找个和你一样的得了,也不用那个最新的了,谢谢

spring hibernate整合问题

启动的时候遇到下面这个问题,查了很多资料也没有找出原因 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485) ... 21 more Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider] at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:197) at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:120) at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:55) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105) at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251) ... 36 more Caused by: java.lang.ClassCastException: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider cannot be cast to org.hibernate.engine.jdbc.connections.spi.ConnectionProvider at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:194) ... 40 more

Spring boot + Spring Data JPA + Hibernate缓存问题

如题,项目框架为Spring boot + Spring Data JPA + Hibernate,hibernate中有Query.list()和query.iterator()方法,其中query.iterator()方法去查询时会用到缓存,返回的参数类型是Iterator,如果使用Spring Data JPA+hibernate如何实现查询一个list使用到缓存呢,JPA中的PagingAndSortingRepository接口中的findAll()方法返回的Iterator类型好像和query.iterator()的效果不一样,哪个哥们可以解答下,万分感激!

Hibernate 配置问题致使出错

![图片说明](https://img-ask.csdn.net/upload/201606/20/1466397390_850146.png) 测试类:SelectText.java package deu.hy.dao; import java.util.List; import javax.swing.JOptionPane; import org.hibernate.Query; import org.hibernate.Session; import edu.hy.model.Admin; import edu.hy.util.HibernateSessionFactory; public class SelectText { public static void select() { Session session = HibernateSessionFactory.getSession(); Query query = session.createQuery("from admin where userid=?"); query.setInteger(0, 1); List<Admin> list = query.list(); String message = list.get(0).getUserName(); JOptionPane.showMessageDialog(null, message); } public static void main(String[] args) { SelectText.select(); } } 实体类: Admin.java package edu.hy.model; public class Admin { private int userid; private String userName; private String password; public Admin() { super(); // TODO Auto-generated constructor stub } public Admin(int userid, String userName, String password) { super(); this.userid = userid; this.userName = userName; this.password = password; } public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } **hibernate.cfg.xml** <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- Generated by MyEclipse Hibernate Tools. --> <hibernate-configuration> <session-factory> <property name="hbm2ddl.auto">update</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.url">jdbc:mysql://lacalhost:3306/qm</property> <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <mapping resource="edu/hy/model/Admin.hbm.xml"/> </session-factory> </hibernate-configuration> **Admin.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"> <hibernate-mapping> <class name="edu.hy.model.Admin" table="admin"> <id name="userid" column="userid"> </id> <property name="password" column="password"></property> <property name="userName" column="userName"></property> </class> </hibernate-mapping> 错误信息: %%%% Error Creating SessionFactory %%%% org.hibernate.InvalidMappingException: Could not parse mapping document from resource edu/hy/model/Admin.hbm.xml at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3409) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3398) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3386) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731) at edu.hy.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:73) at edu.hy.util.HibernateSessionFactory.getSession(HibernateSessionFactory.java:55) at deu.hy.dao.SelectText.select(SelectText.java:17) at deu.hy.dao.SelectText.main(SelectText.java:28) Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping edu.hy.model.Admin at org.hibernate.cfg.Configuration$MappingsImpl.addClass(Configuration.java:2574) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:172) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3406) ... 8 more 麻烦各位大神了

hibernate string型为主键问题

数据库为mysql,主键设为string型的fileName,然后在hbm.xml中设置<id> <generator class="assigned"> 到session.save()时出现下列异常: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.demo.model.UserFiles at org.hibernate.id.Assigned.generate(Assigned.java:33) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99) (下略) 基本上就是存储时主键fileName这个字段没有默认值,无法保存;看来是fileName没有被识别出来,但是程序中我都明明.SetFileName(). 还有hibernate操作int型主键时就没问题,对string型主键不知应该如何处理? [b]问题补充:[/b] to ag_sherry 那是不是数据表还必须设置一个id字段?hibernate会自动为你生成一个32位的无重复的id,不理解,感觉string还不是主键,反倒这个无重复的id是主键了

Hibernate 映射字段问题

用Hibernate 注解来做映射已经使用很长时间了,今天发现一个问题,项目里面实体中的成员变量都不带下划线,而数据库中有下划线,不需要通过@Column指定也可以映射。 例如:类Order中一个成员变量叫orderUser, 而数据库中式order_user。 没有@Column注解指定,也能把这两个字段关联上。请问是Hibernate的自己的特性,还是哪儿配置了

Hibernate在中的 session 管理问题

我用Hibernate生成的HibernateSessionFactory 获得session 写了一个得到数据库数据的方法 用的是Hibernate的 query 结果连接各两三次就包错了 看看是不是写错了 public List getByAll(String hql) { Session session = HibernateSessionFactory.getSession(); List list = new ArrayList(); Query query = session.createQuery(hql); Transaction tx = session.beginTransaction(); try{ list = query.list(); tx.commit(); }catch(Exception e){ e.printStackTrace(); }finally{ } return list; } [b]问题补充:[/b] 我把一场贴出来 报的是Query接口的错误 在List list = query.list()那错了 org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2148) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at SessionDao.getAllDate(SessionDao.java:14) at logon.doPost(logon.java:40) at logon.doGet(logon.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Software caused connection abort: recv failed STACKTRACE: java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:75) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:94) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:122) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1842) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2292) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625) at com.mysql.jdbc.Connection.execSQL(Connection.java:2297) at com.mysql.jdbc.Connection.execSQL(Connection.java:2226) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1812) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at SessionDao.getAllDate(SessionDao.java:14) at logon.doPost(logon.java:40) at logon.doGet(logon.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Unknown Source) ** END NESTED EXCEPTION ** at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2504) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625) at com.mysql.jdbc.Connection.execSQL(Connection.java:2297) at com.mysql.jdbc.Connection.execSQL(Connection.java:2226) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1812) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) ... 24 more [b]问题补充:[/b] 后来我关闭了session。 可是用着用着还是报错了 我用了 懒加载的 是不是数据量大了 session出错了 数据库是mysql 小弟急死了 [b]问题补充:[/b] 这个是 Hibernate的执行语句 Hibernate: select vmark0_.id as id6_, vmark0_.fk_zone_id as fk2_6_, vmark0_.mark_name as mark3_6_, vmark0_.mark_address as mark4_6_, vmark0_.mark_content as mark5_6_, vmark0_.mark_status as mark6_6_, vmark0_.mark_type as mark7_6_ from numdum.v_mark vmark0_ 这个是我写的hql语句 from VMark 这个是VMark的映射文件 <hibernate-mapping> <class name="com.entity.VMark" table="v_mark" catalog="numdum"> <id name="id" type="java.lang.Integer"> <column name="id" /> <generator class="increment" /> </id> <many-to-one name="VZone" class="com.entity.VZone" fetch="select"> <column name="fk_zone_id" unique="true" /> </many-to-one> <property name="markName" type="java.lang.String"> <column name="mark_name" length="50" /> </property> <property name="markAddress" type="java.lang.String"> <column name="mark_address" length="200" /> </property> <property name="markContent" type="java.lang.String"> <column name="mark_content" length="500" /> </property> <property name="markStatus" type="java.lang.String"> <column name="mark_status" length="20" /> </property> <property name="markType" type="java.lang.String"> <column name="mark_type" length="50" /> </property> <set name="VCompanies" inverse="true"> <key> <column name="fk_mark_id" unique="true" /> </key> <one-to-many class="com.entity.VCompany" /> </set> <set name="VShops" inverse="true"> <key> <column name="fk_mark_id" unique="true" /> </key> <one-to-many class="com.entity.VShop" /> </set> </class> </hibernate-mapping> [b]问题补充:[/b] 把改进后的Dao也贴出来 这是操作数据库方法 public List getAllDate(String hql){ List list = new ArrayList(); try{ Session session = HibernateSessionFactory.getSession(); Query query = session.createQuery(hql); list = query.list(); HibernateSessionFactory.closeSession(); }catch(Exception e){ e.printStackTrace(); }finally{ } return list; } [b]问题补充:[/b] 手动关闭,用session.close()关闭后 报 session is ready close 的错 郁闷 [b]问题补充:[/b] 我改了 没用事物了 session.isConnected()是true true Hibernate: select vproducts0_.id as id14_, vproducts0_.fk_protype_id as fk2_14_, vproducts0_.fk_brand_id as fk3_14_, vproducts0_.fk_shop_id as fk4_14_, vproducts0_.pro_name as pro5_14_, vproducts0_.pro_picture as pro6_14_, vproducts0_.pro_inventory as pro7_14_, vproducts0_.pro_total as pro8_14_, vproducts0_.pro_retail as pro9_14_, vproducts0_.pro_wholesale as pro10_14_, vproducts0_.pro_retail_number as pro11_14_, vproducts0_.pro_wholesale_number as pro12_14_, vproducts0_.pro_date as pro13_14_, vproducts0_.pro_status as pro14_14_, vproducts0_.pro_content as pro15_14_, vproducts0_.pro_color as pro16_14_, vproducts0_.pro_if as pro17_14_, vproducts0_.pro_lockup as pro18_14_, vproducts0_.pro_hit as pro19_14_, vproducts0_.pro_if_sale as pro20_14_, vproducts0_.pro_if_inshop as pro21_14_, vproducts0_.pro_sale_date as pro22_14_ from numdum.v_products vproducts0_ org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2148) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at SessionDao.getAllDate(SessionDao.java:17) at logon.doPost(logon.java:36) at logon.doGet(logon.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1845) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2292) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625) at com.mysql.jdbc.Connection.execSQL(Connection.java:2297) at com.mysql.jdbc.Connection.execSQL(Connection.java:2226) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1812) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at SessionDao.getAllDate(SessionDao.java:17) at logon.doPost(logon.java:36) at logon.doGet(logon.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Unknown Source) ** END NESTED EXCEPTION ** at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2504) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625) at com.mysql.jdbc.Connection.execSQL(Connection.java:2297) at com.mysql.jdbc.Connection.execSQL(Connection.java:2226) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1812) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) ... 24 more [b]问题补充:[/b] 弱弱的问一句 会不会是因为session中管理的数据多了 或着是数据库的问题 我用的是懒加载

hibernate和mybatis事务问题

我想在web应用中使用hibernate和mybatis配合做数据持久化,但是遇到数据源和 事务的问题。首先hibernate是使用的proxool连接池,在自己写的hibernate工具 类中加载hibernate的sessionFactory以及session的打开和事务管理等。那么问题 来了,我在mybatis中该如何配置来使用连接池,以及和hibernate使用同一个事务。 请大神支招。

初学Hibernate遇到问题,求解答~

运行一个hibernate例子,但是报错,小白不知道该怎么解决,麻烦大神帮看看。 我把代码贴出来~ (1). package hibernate; import org.hibernate.*; import org.hibernate.cfg.*; import org.hibernate.service.*; import org.hibernate.boot.registry.*; public class NewsManager { public static void main(String[] args) throws Exception { Configuration conf = new Configuration() .configure(); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySettings(conf.getProperties()).build(); SessionFactory sf = conf.buildSessionFactory(serviceRegistry); Session sess = sf.openSession(); Transaction tx = sess.beginTransaction(); News n = new News(); n.setTitle("Java"); n.setContent("Java"); sess.save(n); tx.commit(); sess.close(); sf.close(); } } -------------------------------------------------------------- (2). package hibernate; import javax.persistence.*; @Entity @Table(name="news_info") public class News { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String title; private String content; public void setId(Integer id) { this.id = id; } public Integer getId() { return this.id; } public void setTitle(String title) { this.title = title; } public String getTitle() { return this.title; } public void setContent(String content) { this.content = content; } public String getContent() { return this.content; } } ---------------------------------------------------------- (3). hibernate.cfg.xml文件 <?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"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property> <property name="hibernate.connection.password">root</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property> <mapping class="hibernate.News"/> </session-factory> </hibernate-configuration> (标签贴不出来) ------------------------------------------------------------- (4)错误信息 Exception in thread "main" org.hibernate.MappingException: Unknown entity: hibernate.News at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:781) at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1520) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:679) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666) at hibernate.NewsManager.main(NewsManager.java:24)

关于配置Hibernate乐观锁的问题

直接上代码: <br /><pre name="code" class="java">public class DzCyxx extends BaseEntity&lt;dzcyxx&gt; { private static final long serialVersionUID = 1L; @ManyToOne(cascade = { CascadeType.MERGE }) @JoinColumn(name = "RSXX_ID") private HrArchive hrArchives; @ManyToOne(cascade = { CascadeType.MERGE }) @JoinColumn(name = "ZZJG_ID") private DzZzjg dzZzjg; private Date jrzz_d; private String zw_type; private String zzmm_type; private String bm; private Integer sign; @OptimisticLock(excluded=true) @Version private Integer version; } </pre> <br /> <br /> <br />这样配置version好像不对,启动Tomcat就报错: <br />Caused by: org.hibernate.AnnotationException: @OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: com.gkhb.mis.sxzz.dzz.bean.DzCyxx.version <br /><br /><strong>问题补充</strong><br />Version用的JPA <br />OptimisticLock用的Hibernate  Annotation

hibernate读取EhCache缓存的问题。

如下查询1000-2000左右的数据,有时就会报这个异常,大神们,怎么解决! 十月 20, 2017 5:40:04 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [XXXX] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.cache.CacheException: method <init> (Ljava/lang/Throwable;)V not found] with root cause java.lang.NoSuchMethodError: org.hibernate.cache.CacheException: method <init>(Ljava/lang/Throwable;)V not found at net.sf.ehcache.hibernate.EhCache.get(EhCache.java:103) at org.hibernate.cache.ReadWriteCache.get(ReadWriteCache.java:80) at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache (DefaultLoadEventListener.java:486) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:357) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557) at org.hibernate.type.EntityType.resolve(EntityType.java:379) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2211) at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2127) at org.hibernate.loader.Loader.list(Loader.java:2087) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67) at com.shopping.core.base.GenericEntityDao$2.doInJpa(GenericEntityDao.java:86) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:184) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:147) at com.shopping.core.base.GenericEntityDao.query(GenericEntityDao.java:71) at com.shopping.core.base.GenericDAO.query(GenericDAO.java:98) at com.shopping.foundation.service.impl.GoodsServiceImpl.query(GoodsServiceImpl.java:92) at com.shopping.foundation.service.impl.GoodsServiceImpl$$FastClassByCGLIB$$49a06392.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint (Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept (Cglib2AopProxy.java:635) at com.shopping.foundation.service.impl.GoodsServiceImpl$$EnhancerByCGLIB$$36bbd4e7.query(<generated>) at com.shopping.view.web.action.IndexViewAction.wapindex(IndexViewAction.java:839) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod (HandlerMethodInvoker.java:421) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod (HandlerMethodInvoker.java:136) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod (AnnotationMethodHandlerAdapter.java:326) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle (AnnotationMethodHandlerAdapter.java:313) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.shopping.core.filter.ShopFilter.doFilter(ShopFilter.java:111) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.shopping.core.filter.SecondDomainFilter.doFilter(SecondDomainFilter.java:58) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:378) at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:109) at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:83) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:109) at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:83) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp (SessionFixationProtectionFilter.java:67) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at com.shopping.core.security.support.ShopSecurityExceptionFilter.doFilterHttp (ShopSecurityExceptionFilter.java:64) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp (ExceptionTranslationFilter.java:101) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp (SecurityContextHolderAwareRequestFilter.java:91) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:390) at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89) at com.shopping.core.filter.NorLogoutFilter.doFilterHttp(NorLogoutFilter.java:63) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter

hibernate5 问题,使用注解

``` <?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"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/mytest</property> <property name="connection.username">root</property> <property name="connection.password">zys123</property> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hbm2ddl.auto">update</property> <mapping class="persistence.Message" /> </session-factory> </hibernate-configuration> package persistence; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Message { @Id @GeneratedValue(generator="ID_GENERATOR") private Long id; private String text; private Message nextMessage; Message(){} public Message(String text){ this.text = text; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message getNextMessage() { return nextMessage; } public void setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; } } package Deal; import java.util.*; import org.hibernate.*; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import persistence.*; public class Hello { public static void main(String[] args){ StandardServiceRegistry serviceRegistry=new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build(); MetadataSources m = new MetadataSources(serviceRegistry); m.addAnnotatedClass(persistence.Message.class); SessionFactory sessionFactory=m.buildMetadata(serviceRegistry).buildSessionFactory(); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); Message message = new Message("Hello World"); session.save(message); // session.persist(message); tx.commit(); session.close(); Session newSession = sessionFactory.openSession(); Transaction newTransaction = newSession.beginTransaction(); List messages = newSession.createQuery("from Message m order by m.text asc").getResultList(); System.out.println(messages.size()+"message(s) found:"); for(Iterator<Message> iter = messages.iterator();iter.hasNext();){ Message loadeMsg = iter.next(); System.out.println(loadeMsg.getText()); } newTransaction.commit(); newSession.close(); sessionFactory.close(); } } 十一月 29, 2016 7:42:38 下午 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.2.3.Final} 十一月 29, 2016 7:42:38 下午 org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found 十一月 29, 2016 7:42:38 下午 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 十一月 29, 2016 7:42:38 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead. Support for obsolete DTD/XSD namespaces may be removed at any time. 十一月 29, 2016 7:42:38 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/mytest] 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false 十一月 29, 2016 7:42:38 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 20 (min=1) Tue Nov 29 19:42:38 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 十一月 29, 2016 7:42:38 下午 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver at org.hibernate.boot.internal.ClassmateContext.<init>(ClassmateContext.java:16) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:118) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:113) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:183) at Deal.Hello.main(Hello.java:17) Caused by: java.lang.ClassNotFoundException: com.fasterxml.classmate.TypeResolver at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 8 more ``` 求大神帮忙,调试好长时间不行啊

spring整合 hibernate 映射出问题

报错信息 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegist Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:389) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1799) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:339) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:427) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:412) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ... 25 more Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:341) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:506) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:146) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) ... 34 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135) ... 43 more Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for emloyees in class com.imooc.employee.domain.Department at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:316) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310) at org.hibernate.mapping.Property.getGetter(Property.java:321) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:444) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:200) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:82) ... 48 more 实体类 一方package com.imooc.employee.domain; import java.util.HashSet; import java.util.Set; public class Department { private Integer did; private String dname; private String ddesc; private Set<Employee> employees = new HashSet<Employee>(); public Integer getDid() { return did; } public Set<Employee> getEmployees() { return employees; } public void setEmployees(Set<Employee> employees) { this.employees = employees; } public void setDid(Integer did) { this.did = did; } public String getDname() { return dname; } public void setDname(String dname) { this.dname = dname; } public String getDdesc() { return ddesc; } public void setDdesc(String ddesc) { this.ddesc = ddesc; } } 多方 package com.imooc.employee.domain; import java.util.Date; public class Employee { private Integer eid; private String ename; private String sex; private Date birthday; private Date joinDate; private String eno; private String username; private String password; private Department department; public Integer getEid() { return eid; } public void setEid(Integer eid) { this.eid = eid; } public String getEname() { return ename; } public void setEname(String ename) { this.ename = ename; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public Date getJoinDate() { return joinDate; } public void setJoinDate(Date joinDate) { this.joinDate = joinDate; } public String getEno() { return eno; } public void setEno(String eno) { this.eno = eno; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Department getDepartment() { return department; } public void setDepartment(Department department) { this.department = department; } } 配置文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.imooc.employee.domain.Department" table="department"> <id name="did" column="did"> <generator class="native"/> </id> <property name="dname" column="dname" length="20"/> <property name="ddesc" column="ddesc" length="100"/> <set name="emloyees"> <key column="dno"/> <one-to-many class="com.imooc.employee.domain.Employee"/> </set> </class> </hibernate-mapping> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.imooc.employee.domain.Employee" table="employee"> <id name="eid" column="eid"> <generator class="native" /> </id> <property name="ename" column="ename" length="20" /> <property name="sex" column="sex" length="10" /> <property name="birthday" column="birthday" /> <property name="joinDate" column="joinDate" /> <property name="eno" column="eno" length="20" /> <property name="username" column="username" length="20" /> <property name="password" column="password" length="20" /> <many-to-one name="department" class="com.imooc.employee.domain.Department" column="dno"/> </class> </hibernate-mapping> jar包为 antlr-2.7.7.jar aopalliance-1.0.jar asm-5.1.jar aspectjweaver.jar c3p0-0.9.5.2.jar catalina.jar classmate-1.3.0.jar commons-fileupload-1.3.2.jar commons-io-2.4.jar commons-lang3-3.2.jar commons-logging-1.1.3.jar dom4j-1.6.1.jar ehcache-2.10.3.jar freemarker-2.3.23.jar hibernate-commons-annotations-4.0.2.Final.jar hibernate-core-4.2.21.Final.jar hibernate-ehcache-4.2.18.Final.jar hibernate-jpa-2.0-api-1.0.1.Final.jar jandex-2.0.3.Final.jar javassist-3.18.1-GA.jar jboss-logging-3.1.0.GA.jar jboss-logmanager-2.0.4.Final.jar jboss-transaction-api_1.1_spec-1.0.1.Final.jar log4j-api-2.7.jar log4j-core-2.7.jar log4j-jboss-logmanager-1.1.2.Final.jar mchange-commons-java-0.2.11.jar mysql-connector-java-5.0.8.jar ognl-3.1.12.jar servlet-api.jar slf4j-api-1.6.1.jar slf4j-log4j12-1.7.19.jar spring-aop-4.0.0.RELEASE.jar spring-aspects-4.0.0.RELEASE.jar spring-beans-4.0.0.RELEASE.jar spring-context-4.0.0.RELEASE.jar spring-context-support-4.0.0.RELEASE.jar spring-core-4.0.0.RELEASE-javadoc.jar spring-core-4.0.0.RELEASE-sources.jar spring-core-4.0.0.RELEASE.jar spring-expression-4.0.0.RELEASE-javadoc.jar spring-expression-4.0.0.RELEASE-sources.jar spring-expression-4.0.0.RELEASE.jar spring-jdbc-4.0.0.RELEASE.jar spring-orm-4.0.0.RELEASE-javadoc.jar spring-orm-4.0.0.RELEASE-sources.jar spring-orm-4.0.0.RELEASE.jar spring-struts-3.2.0.RELEASE.jar spring-test-4.0.0.RELEASE.jar spring-tx-4.0.0.RELEASE-javadoc.jar spring-tx-4.0.0.RELEASE-sources.jar spring-tx-4.0.0.RELEASE.jar spring-web-4.0.0.RELEASE-javadoc.jar spring-web-4.0.0.RELEASE-sources.jar spring-web-4.0.0.RELEASE.jar struts2-convention-plugin-2.5.10.jar struts2-core-2.5.10.jar struts2-spring-plugin-2.5.10.jar xwork - jar.jar 哪位大神能给看一下 问题出在哪里

Java Hibernate运行问题

错误信息 ``` java.lang.NoClassDefFoundError: javax/transaction/SystemException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.jboss.logging.Logger$1.run(Logger.java:2554) at java.security.AccessController.doPrivileged(Native Method) at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529) at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516) at org.hibernate.internal.CoreLogging.messageLogger(CoreLogging.java:28) at org.hibernate.internal.CoreLogging.messageLogger(CoreLogging.java:24) at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:86) at com.lee.hibernate.HibernateTest.test(HibernateTest.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 33 more ``` hibernate.cfg.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- 数据库的基本信息 --> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">root</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate</property> <!-- Hibernate基本信息 --> <!-- Hibernate设置数据库方言 --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <!-- 是否在控制台显示SQL语句 --> <property name="show_sql">true</property> <!-- 格式化SQL语句 --> <property name="format_sql">true</property> <!-- 指定自动生成数据表策略 --> <property name="hibernate.hbm2ddl.auto">create</property> <!-- 关联.hbm.xml对象 --> <mapping resource="/com/lee/hibernate/News.hbm.xml"/> </session-factory> </hibernate-configuration> ``` News.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"> <!-- Generated 2015-11-27 21:27:39 by Hibernate Tools 3.5.0.Final --> <hibernate-mapping> <class name="com.lee.hibernate.News" table="NEWS"> <id name="id" type="java.lang.Integer"> <column name="ID" /> <generator class="native" /> </id> <property name="title" type="java.lang.String"> <column name="TITLE" /> </property> <property name="author" type="java.lang.String"> <column name="AUTHOR" /> </property> <property name="date" type="java.sql.Date"> <column name="DATE" /> </property> </class> </hibernate-mapping> ``` News.java ``` package com.lee.hibernate; import java.sql.Date; public class News { private Integer id; private String title; private String author; private Date date; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public News() { super(); } public News(String title, String author, Date date) { super(); this.title = title; this.author = author; this.date = date; } @Override public String toString() { return "News [id=" + id + ", title=" + title + ", author=" + author + ", date=" + date + "]"; } } ``` HibernateTest.java ``` package com.lee.hibernate; import java.sql.Date; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; //import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; //import org.hibernate.service.ServiceRegistry; import org.junit.Test; public class HibernateTest { @Test public void test() { //1 创建一个SessionFactory对象 SessionFactory sessionFactory = null; //1) 创建Configuration对象: 对应hibernate的基本配置信息和对象映射信息 Configuration configuration = new Configuration().configure(); sessionFactory = configuration.buildSessionFactory(); //2)创建sessionRegistry对象: hibernate 4.x新添加的对象 //hibernate的任何配置和服务都需要在该对象注册后才能有效. // ServiceRegistry serviceRegistry = // new StandardServiceRegistryBuilder(). // applySettings(configuration.getProperties()) // .build(); //3) // sessionFactory = configuration.buildSessionFactory(sessionRegistry); //2 创建一个Session对象 Session session = sessionFactory.openSession(); //3 开启事务 Transaction transaction = session.beginTransaction(); //4 执行保存操作 News news = new News("Java", "Lee", new Date(new java.util.Date().getTime())); session.save(news); //5 提交事务 transaction.commit(); //6 关闭Session session.close(); //7 关闭SessionFactory对象 sessionFactory.close(); } } ``` hibernate框架是5.0.0.Final版本 mysql-jdbc驱动是5.1.37-bin版本 JUnit是4.10版本 Java8 Eclipse Version: Mars.1 Release (4.5.1) Windows10 Configuration错误, 但不了解, 麻烦解答

hibernate级联查询的问题

根据项目要求,在每个表中加了删除标志deleted_flag,删除用1标志,未删除用0标志. 在用hibernate本身的级联查询会把之前的子表已经删除的数据也检索出来. 求最好的解决方法. [b]问题补充:[/b] 如果是一对一呢?怎么解决/ 您这上面只有对集合进行 [b]问题补充:[/b] 没有其他方法了吗?把one-to-one改成one-to-many,也太奇怪了.换个角度来说,就是换了它们2者的关系了

hibernate+mysql问题

<p>UserModel.java</p> <p>package cn.javass.model;</p> <p>public class UserModel {<br> private Integer uuid;<br> private String name;<br> private Integer age;<br> public Integer getUuid() {<br>  return uuid;<br> }<br> public void setUuid(Integer uuid) {<br>  this.uuid = uuid;<br> }<br> public String getName() {<br>  return name;<br> }<br> public void setName(String name) {<br>  this.name = name;<br> }<br> public Integer getAge() {<br>  return age;<br> }<br> public void setAge(Integer age) {<br>  this.age = age;<br> }<br> <br>}</p> <p> </p> <p>UserModel.hbm.xml(我想配uuid自增)</p> <p>&lt;?xml version="1.0"?&gt;<br>&lt;!DOCTYPE hibernate-mapping PUBLIC <br> "-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br> "<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>"&gt;<br>&lt;hibernate-mapping <br> package="org.hibernate.auction"&gt;<br> &lt;class name="cn.javass.model.UserModel" table="tbl_user"&gt;<br>  &lt;id name="uuid" unsaved-value="0"&gt; <br>   &lt;generator class="increment"/&gt;<br>  &lt;/id&gt;<br>  &lt;property name="name"/&gt;<br>  &lt;property name="age"/&gt;<br> &lt;/class&gt;<br>  <br>&lt;/hibernate-mapping&gt;</p> <p> </p> <p>hibernate.cfg.xml</p> <p> </p> <p>&lt;?xml version='1.0' encoding='UTF-8'?&gt;<br>&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "<a href="http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd</a>"&gt;</p> <p>&lt;hibernate-configuration&gt;</p> <p> &lt;session-factory&gt;<br>  <br>  &lt;property name="hibernate.connection.driver_class"&gt;org.gjt.mm.mysql.Driver&lt;/property&gt;<br>  &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/dhwebnms&lt;/property&gt;<br>  &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;<br>  &lt;property name="hibernate.connection.password"&gt;xxxxxx&lt;/property&gt;<br>  <br>  &lt;property name="show_sql"&gt;true&lt;/property&gt;<br>  &lt;property name="dialect"&gt;net.sf.hibernate.dialect.MySQLDialect&lt;/property&gt;<br>  &lt;mapping resource="cn/javass/model/UserModel.hbm.xml"/&gt;  <br> &lt;/session-factory&gt;</p> <p>&lt;/hibernate-configuration&gt;</p> <p> </p> <p>public class UserDao {<br> public boolean  create(UserModel um,SessionFactory sf){<br>  Session se=null;<br>  Transaction tx=null;<br>  try{<br>   se=sf.openSession();<br>   tx=se.beginTransaction();<br>   se.save(um);<br>   tx.commit();<br>   se.close();<br>  }catch(Exception e){<br>   return false;<br>  }<br>  <br>  return true;<br>  <br> }<br> <br> public List getAll(){<br>  return null;<br> }<br> <br> public static void main(String[] args) {<br>  SessionFactory sessionFactory=null;<br>  try {<br>   sessionFactory=new Configuration().configure().buildSessionFactory();<br>   UserDao ud=new UserDao();<br>   UserModel um=new UserModel();<br>   um.setName("xyb");<br>   um.setAge(new Integer(10));<br>   ud.create(um, sessionFactory);<br>  } catch (HibernateException e) {<br>   e.printStackTrace();<br>  }<br>  <br> }<br>}</p> <p> </p> <p> </p> <p>运行后就报错,</p> <p>net.sf.hibernate.MappingException: Error reading resource: cn/javass/model/UserModel.hbm.xml<br> at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)<br> at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:990)<br> at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:946)<br> at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:874)<br> at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:860)<br> at cn.javass.dao.UserDao.main(UserDao.java:38)<br>Caused by: net.sf.hibernate.MappingException: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect<br> at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:293)<br> at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:333)<br> ... 5 more<br>Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect<br> at org.dom4j.io.SAXReader.read(SAXReader.java:358)<br> at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)<br> ... 6 more</p> <p> </p> <p>我不知道我的UserModel.hbm.xml的配制文件哪个写错了,请大家帮我看看.谢谢!</p> <p> </p><br /><strong>问题补充:</strong><br />没有听明白<br /><strong>问题补充:</strong><br />两位兄弟,我用的是hibernate2,pan_java回答的肯定不对,但是hibernate2怎么去配的就不知道了,请指教<br /><strong>问题补充:</strong><br />兄弟们: <br />hibernate.cfg.xml <br />&lt;?xml version="1.0" encoding="utf-8"?&gt;&nbsp;&nbsp; <br />&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN"&nbsp;&nbsp;&nbsp;&nbsp; <br />"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"&gt;&nbsp;&nbsp; <br />&lt;hibernate-configuration&gt; <br />&nbsp;&nbsp;&nbsp; &lt;session-factory&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="dialect"&gt;net.sf.hibernate.dialect.MySQLDialect&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.driver_class"&gt;org.gjt.mm.mysql.Driver&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.username"&gt;root&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.password"&gt;xybxyb&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/dhwebnms&lt;/property&gt; <br /> <br /> &lt;property name="show_sql"&gt;true&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp; &lt;/session-factory&gt; <br /> <br />&lt;/hibernate-configuration&gt; <br /> <br />就这样,然后我去SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory(); <br />运行结果是; <br />net.sf.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml <br /> at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:935) <br /> at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:874) <br /> at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:860) <br /> at cn.javass.dao.UserDao.main(UserDao.java:41) <br />Caused by: net.sf.hibernate.MappingException: invalid configuration <br /> at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:931) <br /> ... 3 more <br />Caused by: org.xml.sax.SAXParseException: The content of element type "session-factory" is incomplete, it must match "(property*,mapping+,(class-cache|collection-cache|jcs-class-cache|jcs-collection-cache)*)". <br /> at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) <br /> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source) <br /> at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) <br /> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) <br /> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) <br /> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) <br /> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) <br /> at org.dom4j.io.SAXReader.read(SAXReader.java:339) <br /> at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:930) <br /> ... 3 more <br />请指点 <br /> <br /><br /><strong>问题补充:</strong><br />谢谢各位的帮忙,但是现在为什么插不进数据呀,运行不抛异常,数据库里面没有数据 <br />&lt;?xml version="1.0" encoding="utf-8"?&gt;&nbsp;&nbsp; <br />&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN"&nbsp;&nbsp;&nbsp;&nbsp; <br />"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"&gt;&nbsp;&nbsp; <br />&lt;hibernate-configuration&gt; <br />&nbsp;&nbsp;&nbsp; &lt;session-factory&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="dialect"&gt;net.sf.hibernate.dialect.MySQLDialect&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.driver_class"&gt;org.gjt.mm.mysql.Driver&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.username"&gt;root&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.password"&gt;xxxxxx&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/dhwebnms&lt;/property&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> &lt;property name="connection.pool.size"&gt;1&lt;/property&gt; <br /> &lt;property name="statement_cache.size"&gt;25&lt;/property&gt; <br /> &lt;property name="jdbc.fetch_size"&gt;50&lt;/property&gt; <br /> &lt;property name="jdbc.batch_size"&gt;30&lt;/property&gt; <br /> <br /> &lt;property name="show_sql"&gt;true&lt;/property&gt; <br /> &lt;mapping resource="cn/javass/model/UserModel.hbm.xml" /&gt; <br /> <br />&nbsp;&nbsp;&nbsp; &lt;/session-factory&gt; <br /> <br />&lt;/hibernate-configuration&gt; <br /> <br /> <br />UserModel.hbm.xml <br />&lt;?xml version="1.0"?&gt; <br />&lt;!DOCTYPE hibernate-mapping PUBLIC <br />"-//Hibernate/Hibernate Mapping DTD 2.0//EN" <br />"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"&gt; <br />&lt;hibernate-mapping <br />package="org.hibernate.auction"&gt; <br />&lt;class name="cn.javass.model.UserModel" table="tbl_user"&gt; <br />&nbsp; &lt;id name="uuid" type="java.lang.Integer"&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="uuid" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;generator class="native" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/id&gt; <br />&nbsp; &lt;property name="name"/&gt; <br />&nbsp; &lt;property name="age"/&gt; <br />&lt;/class&gt; <br />&nbsp; <br />&lt;/hibernate-mapping&gt; <br />运行的语句 <br />SessionFactory sessionFactory=null; <br /> try { <br /> <br /> sessionFactory=new Configuration().configure().buildSessionFactory(); <br /> UserDao ud=new UserDao(); <br /> UserModel um=new UserModel(); <br /> um.setName("xyb"); <br /> um.setAge(new Integer(10)); <br /> ud.create(um, sessionFactory); <br /> } catch (HibernateException e) { <br /> e.printStackTrace(); <br /> } <br />数据库中没有值<br /><strong>问题补充:</strong><br />不好意思,我说的不报错,其实错:错误为 <br />se===&gt;net.sf.hibernate.impl.SessionImpl@157aa53 <br />net.sf.hibernate.JDBCException: Cannot open connection <br /> at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:281) <br /> at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302) <br /> at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282) <br /> at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40) <br /> at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19) <br /> at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2227) <br /> at cn.javass.dao.UserDao.create(UserDao.java:22) <br /> at cn.javass.dao.UserDao.main(UserDao.java:48) <br />Caused by: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306? <br /> at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:327) <br /> at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261) <br /> at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89) <br /> at org.gjt.mm.mysql.Driver.connect(Driver.java:167) <br /> at java.sql.DriverManager.getConnection(DriverManager.java:525) <br /> at java.sql.DriverManager.getConnection(DriverManager.java:140) <br /> at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101) <br /> at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278) <br /> ... 7 more <br /><br /><strong>问题补充:</strong><br />我启动了mysql,也开启了事务 <br />public class UserDao { <br /> public boolean&nbsp; create(UserModel um,SessionFactory sf){ <br /> Session se=null; <br /> Transaction tx=null; <br /> try{ <br /> se=sf.openSession(); <br /> System.out.println("se===&gt;"+se); <br /> tx=se.beginTransaction(); <br /> se.save(um); <br /> tx.commit(); <br /> se.close(); <br /> }catch(Exception e){ <br /> e.printStackTrace(); <br /> return false; <br /> } <br /> <br /> return true; <br /> <br /> } <br /> <br /> <br /> <br /> public static void main(String[] args) { <br /> SessionFactory sessionFactory=null; <br /> try { <br /> <br /> sessionFactory=new Configuration().configure().buildSessionFactory(); <br /> UserDao ud=new UserDao(); <br /> UserModel um=new UserModel(); <br /> um.setName("xyb"); <br /> um.setAge(new Integer(10)); <br /> ud.create(um, sessionFactory); <br /> } catch (HibernateException e) { <br /> e.printStackTrace(); <br /> } <br /> <br /> } <br />}<br /><strong>问题补充:</strong><br />mysql我重新启动了,没有问题,用的端口也3306,我安的mysql版本是mysql-5.1.34-win32.msi,我用mysql-gui-tools-5.0-r17-win32.msi我也不知道是不是mysql的版本原因<br /><strong>问题补充:</strong><br />我觉得也是 <br />我想问一下大家:我现在用的驱动是mm.mysql-2.0.4-bin.jar <br />我知道还有一个驱动是mysql-connector-java-3.0.16-ga-bin.jar这两者之间有什么区别,如果我用第二个,那么我的hibernate.cfg.xml真不好意思,麻烦大家这么长时间.<br /><strong>问题补充:</strong><br />各们兄弟,问题找到了,从十点到现在一直在找这个问题,终于找到问题了,我换了一个驱动就行了,以前用mm.mysql-2.0.4-bin.jar ,现在改成了mysql-connector-java-3.0.16-ga-bin.j就能运行,在hibernate.cfg.xml里面改了一下就行了,特别感谢lovewhzlq兄弟.能留下你的qq吗,以后有什么问题请教你。但是为什么用mm.mysql-2.0.4-bin.jar 不行,我也不知道,如果谁知道了,请分享一下.<br /><strong>问题补充:</strong><br />主要是项目中都用那个,我也不是领导,别人这样用,我只能这样用了

hibernate 2级缓存问题

今天在做一个更新操作时采用 HibernateTemplate 中这个方法this.getHibernateTemplate().bulkUpdate(hql, values); 做的时候发现更新后页面查询数据时候缓存没有并没有更新读是旧的数据.后换成this.hibernateTemplate.update(entity);发现在缓存数据更新了正常了.很想知道真正的原因是什么,不知道谁能给我个明确答案。 <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> <prop key="hibernate.current_session_context_class">thread</prop> <prop key="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.memcached.servers">localhost:11211</prop> 这里我的缓存部分配置。。。。。。。。。。。。。。。。

eclipse, hibernate ,hibernate tools 兼容问题

我使用的eclipse 3.2.1 jdk 1.6.0_10 使用哪个版本的hibernate 和hibernate tools 搭配在一起比较好呢?

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:csdn590)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

Windows版YOLOv4目标检测实战:训练自己的数据集

课程演示环境:Windows10; cuda 10.2; cudnn7.6.5; Python3.7; VisualStudio2019; OpenCV3.4 需要学习ubuntu系统上YOLOv4的同学请前往:《YOLOv4目标检测实战:训练自己的数据集》 课程链接:https://edu.csdn.net/course/detail/28745 YOLOv4来了!速度和精度双提升! 与 YOLOv3 相比,新版本的 AP (精度)和 FPS (每秒帧率)分别提高了 10% 和 12%。 YOLO系列是基于深度学习的端到端实时目标检测方法。本课程将手把手地教大家使用labelImg标注和使用YOLOv4训练自己的数据集。课程实战分为两个项目:单目标检测(足球目标检测)和多目标检测(足球和梅西同时检测)。 本课程的YOLOv4使用AlexyAB/darknet,在Windows系统上做项目演示。包括:安装软件环境、安装YOLOv4、标注自己的数据集、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算)和先验框聚类分析。还将介绍改善YOLOv4目标检测性能的技巧。 除本课程《Windows版YOLOv4目标检测实战:训练自己的数据集》外,本人将推出有关YOLOv4目标检测的系列课程。请持续关注该系列的其它视频课程,包括: 《Windows版YOLOv4目标检测实战:人脸口罩佩戴检测》 《Windows版YOLOv4目标检测实战:中国交通标志识别》 《Windows版YOLOv4目标检测:原理与源码解析》

lena全身原图(非256*256版本,而是全身原图)

lena全身原图(非256*256版本,而是全身原图) lena原图很有意思,我们通常所用的256*256图片是在lena原图上截取了头部部分的256*256正方形得到的. 原图是花花公子杂志上的一个

快速入门Android开发 视频 教程 android studio

这是一门快速入门Android开发课程,顾名思义是让大家能快速入门Android开发。 学完能让你学会如下知识点: Android的发展历程 搭建Java开发环境 搭建Android开发环境 Android Studio基础使用方法 Android Studio创建项目 项目运行到模拟器 项目运行到真实手机 Android中常用控件 排查开发中的错误 Android中请求网络 常用Android开发命令 快速入门Gradle构建系统 项目实战:看美图 常用Android Studio使用技巧 项目签名打包 如何上架市场

Java调用微信支付

Java 使用微信支付 一. 准备工作 1.

汽车租赁管理系统需求分析规格说明书

汽车租赁管理系统需求分析规格说明书,这只是一个模板,如果有不会的可以借鉴一下,还是蛮详细的。。。。

C/C++跨平台研发从基础到高阶实战系列套餐

一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,

程序员的算法通关课:知己知彼(第一季)

【超实用课程内容】 程序员对于算法一直又爱又恨!特别是在求职面试时,算法类问题绝对是不可逃避的提问点!本门课程作为算法面试系列的第一季,会从“知己知彼”的角度,聊聊关于算法面试的那些事~ 【哪些人适合学习这门课程?】 求职中的开发者,对于面试算法阶段缺少经验 想了解实际工作中算法相关知识 在职程序员,算法基础薄弱,急需充电 【超人气讲师】 孙秀洋&nbsp;| 服务器端工程师 硕士毕业于哈工大计算机科学与技术专业,ACM亚洲区赛铜奖获得者,先后在腾讯和百度从事一线技术研发,对算法和后端技术有深刻见解。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27272 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程无限观看时长,但是大家可以抓紧时间学习后一起讨论哦~

机器学习初学者必会的案例精讲

通过六个实际的编码项目,带领同学入门人工智能。这些项目涉及机器学习(回归,分类,聚类),深度学习(神经网络),底层数学算法,Weka数据挖掘,利用Git开源项目实战等。

Python入门视频精讲

Python入门视频培训课程以通俗易懂的方式讲解Python核心技术,Python基础,Python入门。适合初学者的教程,让你少走弯路! 课程内容包括:1.Python简介和安装 、2.第一个Python程序、PyCharm的使用 、3.Python基础、4.函数、5.高级特性、6.面向对象、7.模块、8.异常处理和IO操作、9.访问数据库MySQL。教学全程采用笔记+代码案例的形式讲解,通俗易懂!!!

我以为我对Mysql事务很熟,直到我遇到了阿里面试官

太惨了,面试又被吊打

深度学习原理+项目实战+算法详解+主流框架(套餐)

深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)

Java62数据提取代码

利用苹果手机微信下面的wx.data文件提取出62数据,通过62可以实现不同设备直接登陆,可以通过文件流的方式用脚本上传到服务器进行解析

Python代码实现飞机大战

文章目录经典飞机大战一.游戏设定二.我方飞机三.敌方飞机四.发射子弹五.发放补给包六.主模块 经典飞机大战 源代码以及素材资料(图片,音频)可从下面的github中下载: 飞机大战源代码以及素材资料github项目地址链接 ————————————————————————————————————————————————————————— 不知道大家有没有打过飞机,喜不喜欢打飞机。当我第一次接触这个东西的时候,我的内心是被震撼到的。第一次接触打飞机的时候作者本人是身心愉悦的,因为周边的朋友都在打飞机, 每

2018年全国大学生计算机技能应用大赛决赛 大题

2018年全国大学生计算机技能应用大赛决赛大题,程序填空和程序设计(侵删)

Lena图像处理测试专业用图,高清完整全身原图

Lena图像处理测试专业用图,高清完整全身原图,该图片很好的包含了平坦区域、阴影和纹理等细节,这些都有益于测试各种不同的图像处理算法。它是一幅很好的测试照片!其次,由于这是一个非常有魅力女人的照片。

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

verilog实现地铁系统售票

使用 verilog 实现地铁售票

Python+OpenCV计算机视觉

Python+OpenCV计算机视觉系统全面的介绍。

Python可以这样学(第四季:数据分析与科学计算可视化)

董付国老师系列教材《Python程序设计(第2版)》(ISBN:9787302436515)、《Python可以这样学》(ISBN:9787302456469)配套视频,在教材基础上又增加了大量内容,通过实例讲解numpy、scipy、pandas、statistics、matplotlib等标准库和扩展库用法。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

获取Linux下Ftp目录树并逐步绑定到treeview

在linux下抓取目录树,双击后获取该节点子节点(逐步生成)。另外有两个类,一个是windows下的(一次性获取目录树),一个是linux下的(足部获取目录树)

YOLOv3目标检测实战系列课程

《YOLOv3目标检测实战系列课程》旨在帮助大家掌握YOLOv3目标检测的训练、原理、源码与网络模型改进方法。 本课程的YOLOv3使用原作darknet(c语言编写),在Ubuntu系统上做项目演示。 本系列课程包括三门课: (1)《YOLOv3目标检测实战:训练自己的数据集》 包括:安装darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 (2)《YOLOv3目标检测:原理与源码解析》讲解YOLOv1、YOLOv2、YOLOv3的原理、程序流程并解析各层的源码。 (3)《YOLOv3目标检测:网络模型改进方法》讲解YOLOv3的改进方法,包括改进1:不显示指定类别目标的方法 (增加功能) ;改进2:合并BN层到卷积层 (加快推理速度) ; 改进3:使用GIoU指标和损失函数 (提高检测精度) ;改进4:tiny YOLOv3 (简化网络模型)并介绍 AlexeyAB/darknet项目。

手把手实现Java图书管理系统(附源码)

【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序 实例汇总 完整项目源代码

微信小程序 实例汇总 完整项目源代码

基于西门子S7—1200的单部六层电梯设计程序,1部6层电梯

基于西门子S7—1200的单部六层电梯设计程序,1部6层电梯。 本系统控制六层电梯, 采用集选控制方式。 为了完成设定的控制任务, 主要根据电梯输入/输出点数确定PLC 的机型。 根据电梯控制的要求,

相关热词 c#中如何设置提交按钮 c#帮助怎么用 c# 读取合并单元格的值 c#带阻程序 c# 替换span内容 c# rpc c#控制台点阵字输出 c#do while循环 c#调用dll多线程 c#找出两个集合不同的
立即提问