sessionfactory

Nhibernate Error: BuidSessionFactory() Deadlock / Dropping Connection

℡╲_俬逩灬. 提交于 2019-12-12 05:27:47
问题 Good afternoon, I have been stuck on this issue for a number of days now and I don't feel my understanding of Nhibernate / SQL Server is of enough so that I might figure it out. The issue is that any unit test that involves making a call to: Nhibernate.Cfg.Configuaration.BuildSessionFactory(); Just becomes stuck in a running state, I am forced to press 'Stop' in order to get NUnit to respond. At which point an error dialogue appears with the following information: "No connection could be made

Database permissions in MVC with NHibernate

爱⌒轻易说出口 提交于 2019-12-12 04:41:07
问题 I'm working on an intranet MVC web application, using Fluent NHibernate. As everyone knows, creating the necessary ISessionFactory is heavy, and therefore should be done only once. Hence, I create it in the Global.asax file during Application_Start , then cache it in the application for future use. The problem is that I only want to give access to users who already have permissions over the database. This could theoretically be solved by defining Integrated Security=SSPI in the connection

hibernate multiple database configuration files

牧云@^-^@ 提交于 2019-12-12 04:16:29
问题 I have the database config show below file that reads from the application.properties which has information to connect to a single data base. I want to add another similar configuration file that will allow me to connect to another database and use its session factory like the primary one I already have. I am working on making another similar file which reads from another application properties file. However I am not sure how to wire it so that I can have multiple session factories in each of

Hibernate exception: No Hibernate Session bound to Thread

橙三吉。 提交于 2019-12-12 03:59:11
问题 I am trying to use Hibernate when I attempt to open a Session I get the following Exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656) org.springframework.web.servlet.FrameworkServlet.doPost

spring mvc hibernate creating and manipulating sessionfactorys of several databases

一个人想着一个人 提交于 2019-12-12 01:09:18
问题 here I have a problem that I want to find a solution here, I work on a project using spring mvc and hibernate in my project I have several databases with same architecture (database by company) and a database for authentication, when the user login i have to generates a SessionFactory that corresponds to database of the user company, can you help me by offering me an architecture and give me some examples please, sorry for my English. 回答1: Depending on which hibernate version you use you can

java.lang.NullPointerException in session factory building hibernate 4

余生颓废 提交于 2019-12-11 10:47:12
问题 I am simply trying to create a session factory object in hibernate 4. It throws null pointer exception while creating session factory object. Hibernate configuration file <?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.url">jdbc:oracle:thin:@SHKG9072DB:5030:TMSD10G2<

migrating from HibernateTransactionManager to JpaTransactionManager

天大地大妈咪最大 提交于 2019-12-11 06:19:14
问题 I changed the sessionFactory bean creation in an existing application because of various reasons from : <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingLocations" ref="hibernateMappingFiles" /> <property name="hibernateProperties" ref="hibernateProperties" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="transactionManager" class="org

How to add mapping resource to hibernate configuration programatically for session factory creation?

寵の児 提交于 2019-12-11 05:28:16
问题 I am trying to create schema dynamically using hibernate / Java/ GWT, I am creating cfg.xml and hbm.xml files dynamically and storing it in database as blob. So I want to build sessionfactory for the schema. For the same I am creating configuration object using cfg.xml file, but since my hbm.xml files are in other table, they are not files on the file system, so how can I add it to configuration object as resource. I do not want to create files for them on file system . I tried addInputStream

Is there a way to reuse a NHibernate SessionFactory for multiple databases?

我只是一个虾纸丫 提交于 2019-12-09 23:31:37
问题 Like the title says, is there a way to "reuse" a SessionFactory for multiple databases? Since instantiating the SessionFactory takes time, I wonder if it would be possible to pool these instances and reuse them, changing only the connection/database name. Obviously, first level cache would be cleared, but I am trying to avoid the penalty involved in instantiating the factory itself. The background is that I can have several small "pluggable" databases with exactly the same schema, so there is

How would I obtain SessionFactory from the ServletContext in the DAO

被刻印的时光 ゝ 提交于 2019-12-08 13:55:53
问题 I have created a DAO like this: This is based from: Hibernate: CRUD Generic DAO public class Dao{ SessionFactory sessionFactory; // initialise session factory public User save(User o){ return (User) sessionFactory.getCurrentSession().save(o); } public User get(Long id){ return (User) sessionFactory.getCurrentSession().get(User.class, id); } public User void saveOrUpdate(User o){ sessionFactory.getCurrentSession().saveOrUpdate(o); } Now, this is all fine, if my sessionFactory is in the DAO or