Fallstudie

spring3+hibernate4 service 中多线程事务异常及解决

初次使用spring3结合hibernate4做项目,迅速配置完成,测试,一切正常。

然而,当我在service层中另外开启一个线程,线程中的方法需要进行数据库操作,这个时候,悲催的抛出了异常:-org.hibernate.HibernateException: No Session found for current thread

当然,hibernate4的session是和当前线程绑定的,多线程中用sessionFactory.getCurrentSession()获取当前session自然不存在,不存在又不会自动创建,所以抛出了异常,无可厚非。

于是就想着怎么解决这个问题。

遍翻google、baidu,大部分都说如何如何配置,设置事务的传播属性propagation="REQUIRED",开启opensessioninview filter等等,无一对此问题有何解释(当然或许是我没翻到,有知道的麻烦告知)

在http://sishuok.com/forum/blogPost/list/2625.html#7523上看到相关配置,我就想作者这个项目该多线程运行正常吧,果断下载源码,修改测试,oh。。。跟我的错一模一样!

IdentityMine 公司的 Evan Lang 介绍基于一体机开发的空中曲棍球游戏

下载视频

1280X720 (89.49 MB)

IdentityMine 公司的 Evan Lang 介绍基于一体机开发的空中曲棍球游戏,包括对便携式一体机所需的应用开发流程所做的特殊更改。

  • Microsoft Windows* 8.x
  • Windows*
  • 案例研究
  • Sensors-API
  • Touch-Oberflächen
  • Игра Beatbuddy от инди-разработчика движется вперед с новыми технологиями

    Введение

    Каким образом небольшая компания-разработчик игр остается на гребне волны и расширяет свой рынок? Давайте взглянем на инди-разработчика, компанию Threaks, выигравшую множество наград и создавшую BeatBuddy. Беседа с CEO студии, Вольфом Лэнгом, раскроет секреты их непростого пути в мир разработки игр.

    От студенческого до инди-проекта

  • Entwickler
  • Partner
  • Studenten
  • Android*
  • Apple iOS*
  • Microsoft Windows* 8.x
  • Android*
  • Spieleentwicklung
  • UX
  • Windows*
  • Unity
  • Beatbuddy
  • Threaks
  • th3aks
  • 2-in-1
  • unity
  • slate
  • indy
  • Spieleentwicklung
  • Portierung
  • Touch-Oberflächen
  • Benutzererlebnis und Design
  • Clean’Move* Puts Intel® RealSense™ Technology into Sterile Environments

    This case study describes how AFTER-MOUSE.COM incorporated Intel® RealSense™ Technology into the Clean’Move mouse driver. Clean'Move provides a gesture-based, no-touch PC interface that allows users to view and manipulate data while working in a sterile environment.
  • Entwickler
  • Microsoft Windows* 8.x
  • Intel® RealSense™ Technologie
  • Anfänger
  • Intel® RealSense™ SDK
  • Intel® RealSense™ Technologie
  • Intel RealSense SDK
  • Intel RealSense 3D Camera
  • gesture
  • clean'move
  • after-mouse.com
  • Microsoft Windows* 8 Desktop
  • Benutzererlebnis und Design
  • ANSYS* Scales Simulation Performance

    The Need for Speed in Simulation-Based Design

    Engineering simulation software has changed how companies design products, enabling them to explore and test more design options faster, while reducing the need for physical prototyping. ANSYS software has played a central role in this transition and is now used by 96 of the top 100 industrial companies on the FORTUNE 500* list.

  • Entwickler
  • Professoren
  • Studenten
  • Intel® Math Kernel Library
  • Ansys Mechanical
  • Codemodernisierung
  • Intel® Many Integrated Core Architektur
  • Threading
  • Performance of Multibuffer AES-CBC on Intel® Xeon® Processors E5 v3

    This paper examines the impact of the multibuffer enhancements to OpenSSL* on the Intel® Xeon® processor E5 v3 family when performing AES block encryption in CBC mode. It focuses on the performance gains seen by the Apache* web server when managing a large number of simultaneous HTTPS requests using the AES128-SHA and AES128-SHA256 ciphers, and how they stack up against the more modern AES128-GCM-SHA256 cipher.

  • Linux*
  • Server
  • Fortgeschrittene
  • OpenSSL
  • Intel® Xeon® Processor
  • Apache*
  • CBC
  • AES128
  • Sicherheit
  • Calligra* Gemini - Stage & Words Transforming 2 in 1 Interface

    Calligra* Gemini's transformable user interface enables users of Words and Stage to move seamlessly between laptop and tablet mode on 2 in 1 devices.
  • Entwickler
  • Microsoft Windows* 8.x
  • Windows*
  • C/C++
  • Fortgeschrittene
  • 2 in 1
  • ultrabook
  • Calligra
  • Calligra Gemini
  • touch
  • Microsoft Windows* 8 Style UI
  • Open Source
  • Touch-Oberflächen
  • Benutzererlebnis und Design
  • Adventures in Design Thinking

    One of the exciting things happening at Intel these days is our increased focus on user experiences. As a technology company, weaving UX into our culture has required new ways of thinking, innovating, and collaborating—particularly with software developers, since software plays a major role in translating platform features into meaningful experiences.

    Fallstudie abonnieren