-
应用myeclipse生成的HibernateSessionFactory的合理性
使用myeclipse生成的HibernateSessionFactory的合理性作为简单的一个单件模式,getSessionFactory()函数返回null是一个不合理的决定,可以返回一个没有初始化的SessionFactory对象,但是返回null就和这种模式的语意有冲突了。以下是用myeclipse5自动生成的代码:packagemodel.sessionfatory;importHibe...
1
热度 -
【高分求解答】测试方法运行正常能够失去数据,放到Tomcat上边运行就不能够得到数据了
【高分求解答】测试方法运行正常能够得到数据,放到Tomcat上边运行就不能够得到数据了不知道问题出在哪是最烦心的事情,容在下细细道来。要实现的功能:使用hql查询,通过查找Email得到用户的对象首先,看一下Dao层通过Email查询的方法:getUserInfoByEmail(Stringemail)@Override @Transactional(propagation=Propagation...
58
热度 -
getHibernateTemplate()分页有关问题
getHibernateTemplate()分页问题1。我想用这种形式的应该也可以达到分页效果不知道性能怎么样 return(List)getHibernateTemplate().find( "fromfoodwhereCate=?andCategory=?", newString[]{Cate,Category}).subList(Start,end);这个不知...
95
热度 -
项目光报HQL异常,找不到是哪写错了
项目光报HQL错误,找不到是哪写错了是哪一点写错了?分享到:更多varbds_config={"snsKey":{'tsina':'3657746030','tqq':'801356742',}};document.getElementById("bdshell_js").src="http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnvers...
6970
热度 -
spring 接管hebernate 事物 一直失败
求助spring接管hebernate事物一直失败Exceptioninthread"main"HibernateException.html'>org.hibernate.HibernateException:NoHibernateSessionboundtothread,andconfigurationdoesnotallowcreationofnon-transactionalonehere...
4318
热度 -
初学hibernate在与Struts整合创建sessionfactory的时候抛出错误,请高手赐教
初学hibernate在与Struts整合创建sessionfactory的时候抛出异常,请高手赐教小生自学了一下hibernate,想将其加入之前只用struts2写的小项目之中。在下用的是Annotation,在创建SessionFactory的时候抛出如下异常:【在下逛遍了google、baidu,其中的方法都试过了,弄了一下午,依然无解。望得到高手指点!】HibernateExceptio...
109
热度 -
问个低级的return有关问题 关于hibernate
问个低级的return问题关于hibernatepublicListsub(Submenusubmenu){ //初始化事务 Transactiontx=null; //实例化session Sessionsession=sessionFactory.getCurrentSession(); try{ //实例化事务 tx=session.getTransactio...
65
热度 -
Hibernate 创建SessionFactory失败,咋回事
Hibernate创建SessionFactory失败,怎么回事?publicclassHibernateUtil{privatestaticfinalSessionFactorysessionFactory;static{try{Configurationconfig=newConfiguration().configure();sessionFactory=config.buildSessio...
88
热度 -
ORA-00923: 未找到预期 FROM 关键字 的有关问题
ORA-00923:未找到预期FROM关键字的问题,求助代码如下:publicListgetForumMainList(finallongbid,finalintfirstResult,finalintmaxResults){returngetHibernateTemplate().executeFind(newHibernateCallback(){publicObjectdoInHiberna...
770
热度 -
hibernate+struts显示结果的有关问题(菜鸟级的)有方法马上结分
hibernate+struts显示结果的问题(菜鸟级的)有方法马上结分studentDAO里的stulist()方法:publicListstulist(){ Listlist=null; try { Sessionsession=HibernateSessionFactory.getSession(); Transactiontx=session.beginTransaction(); Que...
49
热度 -
hibernate查询语句commit 的时候出现有关问题
hibernate查询语句commit的时候出现问题为什么一执行到tx.commit()就直接走到catch里不能提交呢?控制台也出现了Hql的select语句了啊,大家帮忙看下publicstaticUserfindByName(Stringusername){ Listlist=null; Useruser=null; try{ session=HibernateUtil.currentSes...
86
热度 -
HIBERNATE编译报错解决思路
HIBERNATE编译报错packagemypack;importnet.sf.hibernate.*;importnet.sf.hibernate.cfg.*;publicclassTest{publicstaticvoidmain(String[]args){try{SessionFactorysf=newConfiguration().configure().buildSessionFact...
49
热度 -
TransactionException: Transaction not successfully started
有关hibernate并发的疑惑,求达人指教我根据数据库表用myclipse自动生成对应的DAO,增加了事务处理.然后开两百条线程对表进行save,delete,会出现一下错误1Rjava.lang.NullPointerExceptionR atfes.common.dao.FesAuditcodeDAO.save(FesAuditcodeDAO.java:43)2.Rorg.hibernate...
587
热度 -
关于hibernate的查询有关问题
关于hibernate的查询问题publicAdmindtogetAdminByID(intid){ //TODOAuto-generatedmethodstub try{ Sessions=(Session)hibernateUtil.currentSession();//取得session hibernateUtil.beginTransaction();//开始事务 Admi...
281
热度 -
使用 Hibernate 的 update()方法出现奇怪的有关问题
使用Hibernate的update()方法出现奇怪的问题DAO中,我写了个update方法如下:Javacode/***自己写的更新记录函数*/publicbooleanUpdateOperatorInfo(OperatorInfooperatorinfo){booleanb=false;Sessionsession=(Session)this.getSession();Transactiont...
579
热度 -
spring3.1的整合hibernate4.LocalSessionFactoryBean必须找hibernate.cfg.xml有关问题
spring3.1的整合hibernate4.LocalSessionFactoryBean必须找hibernate.cfg.xml问题spring3.1下配hibernate4.0由于没有了hibernateTemplate类,只能配hibernate4.LocalSessionFactoryBean但是编译时说事找不到hibernate.cfg.xml,我是利用bean注入的,不想用hiber...
249
热度 -
如若一个方法包含在事物中,那么该方法可以视为同步吗
如果一个方法包含在事物中,那么该方法可以视为同步吗?spring+hibernate+struts2整合后,假设在我的DaoImpl类中有如下代码Listlist=getHibernateTemplate().executeFind(newHibernateCallback(){ publicObjectdoInHibernate(finalSessionsession) throws...
62
热度 -
路过的,帮忙看下hibernate查询
路过的大虾,帮忙看下hibernate查询Javacode/**Findalleventsinthegivenmonthandyear.*@parammonth-0-11(0=January)*@paramyear*/publicListfindEventsFor(intmonth,intyear){Listevents=null;try{startOperation();DatefirstDay...
27
热度 -
spring 接管hibernate 事物 失败
求助spring接管hibernate事物失败Exceptioninthread"main"HibernateException'>org.hibernate.HibernateException:createQueryisnotvalidwithoutactivetransaction atorg.hibernate.context.ThreadLocalSessionContext$Trans...
606
热度 -
rror creating bean with name 'sessionFactory' defined in ServletContext resource,该如何解决
rrorcreatingbeanwithname'sessionFactory'definedinServletContextresourceorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinServletContex...
374
热度