multiple « Session « JPA Q&A





1. Multithread issues in using Hibernate SessionFactory    stackoverflow.com

Have a table 'temp' .. Code:

CREATE TABLE `temp` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `current` tinyint(1) NOT NULL DEFAULT '1',
  `closed_at` datetime ...

2. Hibernate Session Threading    stackoverflow.com

I have a problem regarding Hibernate and lazy loading. Background: I have a Spring MVC web app, I use Hibernate for my persistence layer. I'm using OpenSessionInViewFilter to enable me to lazy load ...

3. How to configure ColdFusion's ORM for multiple session scope DSNs?    stackoverflow.com

How do you configure ColdFusion 9's ORM to use multiple DSNs if possible? Is is possible to setup the datasource in the context of a session scope instead of the application scope? Or ...

4. SEQHILO and multiple SessionFactories / JVMs    forum.hibernate.org

Hi, Currently we are using sequence as the id generator but where we have a lot of inserts (which are done as part of a wider saveOrUpdate on a parent object) hibernate is selecting from the sequence and then running the insert, understandably so that it can set the id onto the object, but this appears to be causing quite a ...

5. What does it mean to open multiple sessions?    forum.hibernate.org

6. lazyinitialization doesnt work for multiple sessionfactories    forum.hibernate.org

Hello All, I have project in which we have used spring-hibernate with tomcat, In our project we have several one->Many relationships. So we are having set for all the child record in parent class. For Child Sets We have done lazy="true" in hbm.xml file.so the objects does not load if not required. and to load the lazy objects in jsp we ...

7. Multiple Session factory    forum.hibernate.org

I need to have 1 application per client database,suppose i had a application,i want to run it in different departments with with different DB's but it should create a session factory at run time based on request..or some way to have more than 1 session factories...how it can be possible is any 1 having solution for this ?

8. Multiple Sessions in a single thread?    forum.hibernate.org

Newbie Joined: Wed Oct 15, 2003 4:31 pm Posts: 17 Howdy, I'm writting some generic service routines that need access to the database via hibernate and need to make changes via a transaction independent of any other Hibernate associated sessions/transactions. I'm finding that in my "second" (that is, in creation order within the same thread) session, I can make a change ...

9. Multiple copies of an object in a session    forum.hibernate.org

How do you retrieve an entity object in a session without getting a new copy? I have a developer that is doing a session.load() for an object and then an update. The update is saying the object's Id is a duplicate of an existing object in the session. I walked through his code and it sure appeared that he is retrieving ...





10. how to handle muulti-threading and multiple sessions    forum.hibernate.org

I am converting an app to use hibernate. The app has the main gui and several background threads providing synchronization to a centralized database (via web services NOT hibernate). So ther eis a local datbase that the app talks to via hibernate and another database that the app synchs too through web services (no hibernate). Say I have Class as follows ...

11. Any Problem With Multiple SessionFactories?    forum.hibernate.org

We are currently developing an application that will end up having 3 SessionFactory instances, with slightly different mappings pointing to the same database and tables. Unfortunately timescales of the project is restricting our ability to rationalize these to use a single SessionFactory. One will be used for general updating, while the other two will be used for search queries. Can anyone ...

12. Multiple SessionFactory    forum.hibernate.org

Hibernate version:2.1.6 Hi Guys: For my Stand alone application , I m trying to use Hibernate for persistence layer. Currently, the stand alone application is using direct JDBC for Data access. We are trying to change it to Hibernate. We are connecting to 4 different databases with different data modelling. I know that I need to configure multiple SessionFactory objects. Is ...

13. problem with multiple threads - sessions closing early?    forum.hibernate.org

Hibernate version: 2.1.6 Hey guys, I'm running into a strange problem with multiple threads in my Hibernate webapp. Each HttpServletRequest gets its own Session from the shared SessionFactory. When only one thread is active at a time, everything is fine. When two threads are active at the same time, one of them almost inevitably throws a LazyInitializationException while traversing the object ...

14. multiple session factories for two different db    forum.hibernate.org

Hello: I apologize if this topic has already come up in this forum. I did a search and it came back with over 5000 records. So I decided to try this route instead. We are in the process of migrating some data from a DB2 AS400 environment to Oracle on Linux. What I would like to do is use Hibernate to ...

15. session across multiple databases?    forum.hibernate.org

I am wondering how it might be possible to work with multiple databases at the same time with Hibernate? I have a scenario with multiple 2 different databases (different DB software, different platforms). AFAIK, this would require Two SessionFactories(each one configured for respective database), then maintaining two Hibernate sessions in my application. However, while each individual object can be guaranteed to ...

16. One SessionFactory, multiple ClassLoaders?    forum.hibernate.org

Hibernate version: 2.1.7c I have a situation where I have multiple classloaders over the lifetime of my application, each bringing its own set of mappings. Right now, I have multiple SessionFactories, one for each classloader. I would like to try sharing one SessionFactory over all classloaders. My problem is that during the buildSessionFactory() stage, Configuration wants to find classes in the ...





17. How to have multiple sessions?    forum.hibernate.org

public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { // Cre la SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (HibernateException ex) { throw new RuntimeException("Problme de configuration : " + ex.getMessage(), ex); } } public static final ThreadLocal session = new ThreadLocal(); public static Session currentSession() throws HibernateException { Session s = (Session) session.get(); // Ouvre une ...

18. Multiple SessionFactories and caches    forum.hibernate.org

We've got multiple SessionFactories due to having multiple databases; each db has the same schema so each SessionFactoy shares the same class mapping files. We enabled Ehcache for one of the factories by setting hibernate.cache.provider_class in the factory's configuration. Mysteriously, though, one of the SessionFactories that has not had cache enabled is nevertheless using that cache. I'm a bit confused now ...

19. Drawbacks to Multiple Session Factories?    forum.hibernate.org

I hate to ask a question that's already been asked but I did spend quite a bit of time searching the forums before asking this question. We have a use-case that would require us to use multiple databases (and therefore multiple session factories). What are the drawbacks, if any, to doing this? I ask because it seems like the Hibernate team ...

20. Multiple Session Factories    forum.hibernate.org

I have an application that gets data from multiple databases. All databases have the same schema. I use multiple SessionFactories to query the data. There are over 50 database partitions, so I had to use 50 configuration files to get it working. I would rather have one file, that has multiple session factories. Is this possible? I have read the documentation ...

21. Multiple SessionFactories or single factory passing db conn?    forum.hibernate.org

Hibernate version: 3.0.5 In our system we currently have 1975 tables for our ERP product. We we deploy the session factory we have to allocate around 128 meg. of PermSize space for the single session factory to be deployed. More if we want to be able to redeploy. My question is as follows... In order to allow our program(s) to connect ...

22. SessionFactory for multiple databases??    forum.hibernate.org

Hi all, I have a doubt and if someone can answer my questions it will be great. If an application uses two databases say SQL and HSQL, then do we need to create two session factory instances? Does hibernate allow us to create multiple session factory instance? For this to happen we need to provide two configuration files, right? please answer ...

23. Overhead of multiple session factories...    forum.hibernate.org

Managabiliity: the application (which uses Hibernate) uses third party products that also use hibernate. Having one session factory per product makes it easy to manage the persistence configurations for these products independently. Here independent session factories are possible since the products communicate with each other exclusively through APIs and not through the database.

24. Multiple SessionFactories for same database    forum.hibernate.org

Using Hibernate 3.1, PostgreSQL 8.1. I have a problem with a contact database I am building. Each of the contacts in the contact database may be shared by multiple user groups or may be unique to a specific user group. The number of contacts could be in the hundreds of millions, and most of these will be shared contacts. The data ...

25. Logging for multiple session factories in a managed environm    forum.hibernate.org

Hi, I've been looking for a way to differentiate the log output of multiple SessionFactory instances in a JBoss server. More specifically; I have multiple SessionFactory instances bound to JNDI in a single JBoss server instance. I want to be able to set the log level to DEBUG for SessionFactory 1 and all the Session's built using it, but keep the ...

26. Multiple retrieves + CRUD on same session    forum.hibernate.org

Hi, I have the following use case: - Retrieve data (say Customer objects) on Hibernate session by executing a query. - Create some extra customers on same session. - Delete some customers on same session. Now I want to iterate over the total, "current" customer collection, i.e. retrieved + created - deleted. As far as I can see, there is no ...

27. Multiple Session Factories in Hibernate 3.2    forum.hibernate.org

Hi, I want to open multiple session factories on a single machine. But I get the error of ehcache which says that it cannot open the second ehcache manager instance on the same local file path. The exception is: org.hibernate.cache.CacheException: Attemp to restart an already started EhCahceProvider . Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache ...

28. Multiple Hibernate Session Factories    forum.hibernate.org

Hi All, I have two applications, different ears which use JNDI bound session factory, each one has different name like Hibernate/TrxHibernateFactory, Hibernate/AppHibernateFactory. I want to know when they are deployed on the app server & accessed concurrently does two hibernate session factories will be created udner JNDI Tree or first one is created then agian rebinded . thanks in advance. *satish ...

29. Multiple session factories pointing to the same database    forum.hibernate.org

Hi, In our project, we have two separate applications (2 ear files) both of which need to access the same database. Both these ear files can be deployed either in a single JBoss server or two separate Jboss servers. Can we create separate session factories one for each application that point to the same database? Would we have any problems in ...

30. one sessionfactory, accessing multiple schemata    forum.hibernate.org

Hello *, at the moment i am working on a project using hibernate. We usa a mysql db. Only one database but multiple schemata. I tried creating one sessionfactory (and one hibernate.cfg.xml) for each schemata and it worked without problems. I think it would be cleaner and much easier to maintain only one sessionfactory for all schemata/schemas. The documantation mentions that ...

31. Multiple sessionFactory objects    forum.hibernate.org

Hi all We want our applpication to point to two different databases depending on the incoming request. Is this possible in hibernate, as I assume that we can have only one hibernate.cfg.xml which in turn can have the database details for only one database. Or can we modify the HibernateUtil such that it creates two sessionFactory objects. is this possible at ...

32. multiple session factories for multiple databases    forum.hibernate.org

hi all, my application uses multiple databases and as per hibernate i will have to create multiple session factories (as in one session factory for one database). now do i need to have differnet configuration files for that or can i incorporate multiple elements in the same .cfg.xml file? Can anybody send me a link where can i get samples ...

33. Comparison between using dblink and multiple sessionfactory    forum.hibernate.org

Hi, I have an application which currently uses one datasource. We have a new requirement, for which we need to fetch some data from another database. There are two options. 1. Create a view in the second database and access that view by creating another sessionfactory in the code and access it directly. 2. create a dblink from first db to ...

34. Same SessionFactory against multiple databases    forum.hibernate.org

Hello... I need to connect to different databases running on a same MySql Server from my application. How can I do it using Hibernate. My application should connect to different databases based on the user login. It will be difficult to use multiple data sources and multiple SessionFactories , since the number of databases is more. So my plan is to ...

35. StaleObjectStateException occuring when multiple sessions    forum.hibernate.org

Newbie Joined: Thu May 29, 2008 2:01 pm Posts: 2 Hibernate version:3.2.6 Spring 2.5.4: JTA Transaction Manager: BTM Name and version of the database you are using:Sybase ASE 12.5.4 I'm having a rather odd issue with Hibernate in only one spot within our application. We have two components to our application: 1) is the Web Application. 2) is the server application. ...

36. Multiple session in hibernate?    forum.hibernate.org

If I have a hibernate apps that need to open multiple connection, how to do this? I think should be : hibernate.cfg.xml Code: ...

37. Multiple Session Factories To One Database    forum.hibernate.org

Hi, Done a bit of research on my own and haven't found anything addressing the follow situation. I have an application that runs on several separate machines, each being it's own separate and independent instance, all having session factories to the same database. I'd like to ensure that all db operations are written to the db asap so that other instances ...

38. one session factory multiple database    forum.hibernate.org