`
- 浏览:
43738 次
- 性别:
- 来自:
武汉
-
If I can't lead myself, others won't follow me.If I can't lead myself, others won't respect me.If I can't lead myself, others won't partner with me.
Hi
I don't know if this is the place to make this question but I'll try.
So I have an application using Spring + JBoss. Since I just recently integrated the spring security framework (meaning acegi) I use a JdbcTemplate, which has a DataSource that it uses to get the connection. At the same time I user the Hibernate SessionFactory, which also use the same data source to fetch connections.
So the problem I have is that I want to get the same connection which should be handled by the TransactionManager and then be under the same transaction.
How is the transaction working ? I kind of figured out that the datasource returns ManagedConnections where I guess the close method is overridden to avoid having a close called on the underlaying connection, which is pooled. What happens if I call a close method? Is JBoss keeping track of if the user is doing this and then letting the ManagedConnectionInterceptor warn the user that "hey you did not close the connection I will do it but next time please close it your self". If this is the case what happens if I remove the ManagedConnectionInterceptor will the underlaying connection be keept open and thereby work when the next call comes in.
The reason I'm asking is that the JdbcTemplate per defult closes the connection and if I override that what will happen?
On that note what happens if I let the JdbcTemplate close the connection, which is a ManagedConnection wil that close the underlaying connection ?
How is the TransactionManager involed in all this. I guess it starts a transaction and keeps it in a thread local (or something simular) and then it enlists all the transaction enabled resources I use and do a two-phase commit when the transaction manager is asked to end te transaction? I'm a bit vague here since I really dot now how it works and maybe some kind soul feel like explaining it to another soul :-) Especialy how is the transaction manager working togheter with the Hibernate SessionFactory so hat the DataSource nows to return a ManagedConnection that is tied to the TransactionManager...?
The real problem is that I want to combine the transaction interceptor in Spring with the Hibernate SessionFactory and a JdbcTemplate using the same DataSource.
Hope its not to much at one time but I just frustrated about my limited mind not getting it all 100 %
if you have any other questions just feel free to ask...
thank you very much Jacob, your help has been very valuable!!!
Hello,
I've successfully added a security-constraint into the web.xml of a
webapp so the user has to use a login to use the webapp.
Is it possible to move this config into the conf/web.xml instead?
I have tried this but the security-constraint affects other webapps.
I've tried changing the url-pattern to "/MyApp/*" but that doesn't work.
thanks,
Jurn
What is success?
To laugh often and much;
To win the respect of intelligent people and the affection of children;
To earn the appreciation of honest critics and
endure the betrayal of false friends;
To appreciate beauty;
To find the best in others;
To leave the world a bit better, whether by a healthy child, a garden patch
or a redeemed social condition;
To know even one life has breathed easier because you have lived;
This is to have succeeded.
the definition of success is vary from person to person,in my mind,success is you can treat it correctly~~~
Hi!
I've got a task to tune JBoss Cache as second-level cache for Hibernate.
On Jboss Cache web-site they say:
"JBoss Cache >= 3.0.0 and Hibernate >= 3.3.0 is your optimal configuration, using MVCC as a locking scheme on JBoss Cache."
But I couldn't find corresponding bridge library for Hibernate and JBC 3*.
Maybe I have to use JBC2* despite optimistic statement on their site?
re:
the solution for now is:
as far as JBC3 has backward compatibility with JBC2 config and bridge(hibernate-jbosscache2) is used just like for 2-nd version of JBC and works well.
it occured that JBC developers are planning to code hibernate-jbosscache3 but so far there's no release.
I Have one entity [Project] that contains a collection of other entities [Questions].
I have mapped the relation with a cascade attribute of "all-delete-orphan".
In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a Question without a Project.
When I do session.delete(project) it throws an exception saying that project_id cant be null, but if I remove the not-null constrain to that field, the deletion works nice.
Anyone knows how to solve this?
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
2.2 参考脚本 ......................................................................................................................26 2.2.1 创建示例库 ....................................................
欢迎使用...........................................................................................................................................2 1. 产品简介 ........................................
0.环境说明...............................................................................................................................................................7 1.Eclipse简介...................
轻量化json......................
目录 .........................................................................................................................................................1 JVM ......................................
1 概述 ................................................................................................................................................. 5 1.1 项目背景 ..................................
..............................362.3.4 Traceview性能分析工具 ......................................372.4 Git版本控制系统 ...............................................382.4.1 Git简介 ....................
第一章 产品介绍...................................................................................................................................1 1.1 锐捷NBR系列路由器..................................
.............................................................................50二、公共交通票务系统 ...............................................................................52三、航空行李追踪 .....
安卓内置的浏览器内核,适用于x86构架,如:华硕ze551ml....,最低系统要求安卓5.0.........................................................................................................................
.................................................................25(一)、当前技术特点......................................................................................................................
Coding in pTAL.................................................................................................................................... 419 Coding in PL/I (z/OS only)..........................
1 概述 ............................................................................................................................................... 12 1.1 功能框图....................................
算是一个小小的支持吧,资源不太好找............................ ............................................................................................................................................
1.1 简介 .............................................................................................................. 13 1.2 编译器说明和文档 ...........................................................
文档的目的 ....................................................................................................................................... 1 版本信息 .............................................
jar包下载10.2.0.1.0.jar版本 .............................................................................................................................
...........................................................................................................................................................................................................
实现数据互联互通...........................................................................102.6.3 系统应具备良好的兼容性和适应性..........................................................................