database « Session « JPA Q&A





1. Check if object exists in database WITHOUT using Session.get    forum.hibernate.org

I wonder if it's possible to check if an object exists in the database without using the Session.get(Class clazz, Serializable id) method ? I want to be able to do this check at anytime in the application. When using the Session.get(Class clazz, Serializable id) method, it's required that the object to check for is associated with the Session. I want to ...

2. how to do session-db resync?    forum.hibernate.org

3. Database URL from Session?    forum.hibernate.org

Hello. If I've missed the answer to this I apologize. I'd appreciate any nudge in the right direction. Short question: Can I get the database URL given only a Session object? Long version: I'm writing an Oracle database monitoring system using Hibernate. I iterate through a list of SessionFactory's which represent connections to the databases I want to monitor. I then ...

4. One SessionFactory, Many Databases    forum.hibernate.org

It would be nice if I could use only one SessionFactory to work with many databases; obviously I mean many databases on the same database server and with identical schema. I think to define one Configuration and obtain a SessionFactory from it; after that, obtain Session from the SessionFactory providing the JDBC Connection to the choosen database (even if I'm not ...

5. mulitple sessionfactory for one database    forum.hibernate.org

When You are using a second level cache, You have to choose one with cluster capability. Transactions are handled by JDBC-driver of the the Database. So it should not be any concern as long You are using the same database. The clustered cache means a significant overhead (especialy when threads are on different machines), so I used a JMS-based cache to ...

6. how to disable sessionFactory connect to database on startup    forum.hibernate.org

how to disable sessionFactory connect to database on startup I implemented a custom ConnectionProvider for hibernate to get connection. I will set the dataSource params on running. the sessionFactory try to get connection on startup, it always show errors. it 's not welcome for using. how to disable sessionFactory connect to database on startup.

7. How to get SessionFactory class's object with multi database    forum.hibernate.org

Hi everybody. In my code. I need to connect multi databases at same time. I readed Hibernate manual. for only one db. I need to create a Hibernate.cfg.xml and a class to get a SessionFactory type object. but for multi database. I think the most simple way is like this. public class HibernateSessionUtil { private static SessionFactory sessionFactory1; private static SessionFactory ...

8. One Hiberntate Session For Many Databases    forum.hibernate.org

9. Problem with Hibernate n database Session    forum.hibernate.org

hi! I have a problem with hibernate session ... Although i close the session in the end n the same reflects in the logs but in the database it opens a new session every time i run the query from my application . I have also fixed the connection pool size to 5 in the config file but still it opens ...





10. Objects in session (entitiesByKey) inconsistent with db    forum.hibernate.org

I have a situation today where the following method is returning a stale version of an object. When I look at the database, it is current! I have set a break point in my IDE and drilled into the PersistentContext. I see the object in the entityByKey Map, and it is stale. Any ideas? public Object getObject(Class clazz, Long id) { ...

11. is session cleaning database table?    forum.hibernate.org

Newbie Joined: Thu Jun 07, 2007 7:50 am Posts: 2 Hi I'm trying hibernate retrieve data from MySQL database. When I am running my FirstExample.java file, It first clean my database table 'users' and then retrieving data. this means my query doesn't have any data. it returns null. Can any body tell me why it is happening. here are my code ...

12. Alter Database Session    forum.hibernate.org

After I start a session with my database using sessionFactory, what is the proper way to issue an alter session command against the database? Specifically, I am trying to change the time zone that the session is using on the fly. If I was doing this against Oracle through a regular query tool like TOAD, I would connect to the database, ...

13. Session recovery after DB crash    forum.hibernate.org

Hi I have a java application using hibernate and connecting to oracle DB. I am using SessionFactory object from which I get statelessSessions connections. The problem is that the mechanism doesn't recover after DB restart. I receive the following error: aused by: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1135) at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115) ... 3 more How ...