session 1 « Session « JPA Q&A





1. Hibernate: comparing current & previous record    stackoverflow.com

I want to compare the current value of an in-memory Hibernate entity with the value in the database:

HibernateSession sess = HibernateSessionFactory.getSession();
MyEntity newEntity = (MyEntity)sess.load(MyEntity.class, id);
newEntity.setProperty("new value");
MyEntity oldEntity = (MyEntity)sess.load(MyEntity.class, id);
// CODEBLOCK#1 ...

2. hibernate session problem new    stackoverflow.com

I am using Hibernate in NetBeans. I am using the hibernate util class that comes with the Hibernate plugin for NetBeans to get the current session. That is, I ...

3. Hibernate Question on Sessions    stackoverflow.com

I am writing a web application that allows a user to get an employee's personal information and edit it (email, phone, name, etc). When I deploy the application on the server, ...

4. hibernate - session monitor tool    stackoverflow.com

please tell me is there anytool to monitor hibernate sessions in case of session leakage Thank you.

5. Session class in NetBeans IDE6.7    stackoverflow.com

can we use Session class in Netbeans IDE 6.7.do we have to include any package for it.also if anybody can provide a sample example related to this question.

6. Should I use static of non-static sessions?    stackoverflow.com

I've recently taken on the database/hibernate side of our project and am having terrible trouble understanding some fundamentals of our design regarding the use of managed sessions. We have a util class ...

7. naming conventions in Hibernate    stackoverflow.com

could any one please tell me what is the naming convention the Hibernate developers fallowing to give names for DAO calass, Sesgleton class which create Single SessionFactory and retuns Session throug ...

8. @Before and @After exclusion    stackoverflow.com

I'm writing some tests for my DAO, and because a lot of the tests use a test object that is being saved to my database I've created a setup() and teardown() ...

9. Simplest way of using Hibernate Sessions    stackoverflow.com

I'm coaching a student project which uses hibernate as a persistence layer. From my projects at work I'm already quite familiar with hibernate and can use it with few 'troubles'. But ...





10. Hibernate Session is invalidated after ConstraintViolationException    stackoverflow.com

Is there any way to continue using an thread bound hibernate session after constraintviolation exception has been thrown? I'm giving a short example here:

    Parent other=service.load(33); // loads ...

11. How hibernate session works    stackoverflow.com

I have some kind of trivial queries in Hibernate.

  1. If I assume there are two instances running and each is using its own hibernate session. If one session inserts data into DB ...

12. Hibernate Session    stackoverflow.com

I am using hibernate GenriDAO Here is my code::

 private Class<T> persistentClass;
 public Class<T> getPersistentClass() {
         return persistentClass;
 }
 public GenericHibernateDAO(Class<T> persistentClass ){
  ...

13. What is contextual sessions in hibernate?    stackoverflow.com

  1. What is contextual session in Hibernate?
  2. When I created and closed a sessions in between use contextual session implementation interfaces?

14. Hibernate session managment    stackoverflow.com

I am using hibernate+jsp+postgres database

void TestMethod(){
HibernateSessionManager hs=new HibernateSessionManager();
Session ses=hs.preHandle();         
 //  Here  is my code that uses session
   ...

15. netbeans platform and hibernate - slow session creation    forums.netbeans.org

public class HibernateUtil { private static SessionFactory sessionFactory; private HibernateUtil(){ } static { URL myUrl = Thread.currentThread().getContextClassLoader().getResource("my/package/hibernatemodule/hibernate.cfg.xml"); sessionFactory = new Configuration().configure(myUrl).buildSessionFactory(); } ...

16. Hibernate Session closure    coderanch.com

Hello, We are starting to use Hibernate in a managed environment. Our application architecure consits of a Session Facade which delegates requests to SLSB business objects. These business objects are responsible for mapping the DTOs to POJOs (and back) and calling the persistence layer. Mixing data access code with business logic, violates our emphasis on separation on concerns and therefor we ...





17. java.lang.NoClass DefFoundError: org/hibernate/Session    coderanch.com

Hi, I have created a "reporter" folder(application) under Tomcat 5.0. So I placed all required jars including hibernate3.jar and jdbc driver jar under the following directory. C:\Tomcat 5.0\webapps\reporter\WEB-INF\lib I placed the hibernate.config.xml, mapping file and all the cllasses in C:\Tomcat 5.0\webapps\reporter\WEB-INF\classes I set an environmental vaiable TOMCAT_HOME to c:\Tomcat 5.0 But I am getting "java.lang.NoClassDefFoundError: org/hibernate/Session". What could be the problem? ...

18. Sessions in Hibernate    coderanch.com

I am creating a webapp that will only (almost) be reading from- and never updating or inserting stuff into the database. Is there some intelligent way to use Hibernate Sessions in order to fully take advantage of the "cache" they provide. One thought I had was to use "long sessions" to let the Hibernate Sessions live throughout the user session. Is ...

19. getting session from hibernate session factory    coderanch.com

Hi all, i am using hibernate 3.1 and writing some code for getting object from database code is written below: But "HibernateSessionFactory.getSession()" taking a lot of time to execute. please suggest me ways to speedy my hibernate application. public Testinfo getUser(Integer userId) throws VdnsException Testinfo testinfo = null; Session session = null; Transaction tx = null; session = HibernateSessionFactory.getSession(); tx = ...

20. where is net.sf.hibernate.Session?    coderanch.com

Hi Jaikiran, Thanks....but now you have me wondering if there is there a "better" way to do a "find" using Hibernate 3. I think you mentioned using get in an earlier posting, but most of my books, which using HQL are still using find. What would you recommend? Look forward to your follow-up comments. Thanks!!! Mike

21. hibernate session    coderanch.com

can you tell me how to maintain old session to track the same user's information.After sending the response the session will be lost ,then how to track the same user in the next request. Please let me know, if i am using struts and using hibernate util class to open and close session: Where to open and where to close session ...

22. Synchronizing two hibernate sessions    coderanch.com

[code] I have two applications , say App1 and App1Admin. Both runs on a the JBoss server as separate wars. Both of them use Spring with Hibernate. The scenario is if App1Admin changes something, The App1 should reload that changes immediately in the same hibernate session, it is already running in. So, what are the possible options to achieve this ? ...

23. Hibernate session    coderanch.com

Hi there, This is my first dab at hibernate and have come across a situation wherein 1. i have a collection of POJO objects 2. the object has a property called areaId 3. I need to use this property in query in the where clause with a join with another table. i can at the moment i can do this in ...

24. Hibernate Session Best Practice    coderanch.com

Hi guys. For a web application how many hibernate session should be opened for a one web user session? So is it like? 1 User Session = 1 Hibernate Session How would I know then on when to close a hibernate session if a user just abandoned the application without properly logging out to invalidate all sessions?

25. Hibernate Session Problem    coderanch.com

I am working on a small swing application with hibernate(DB2 as DB). What is a better aproach of using session ? closing it after a transaction or retaining a single session through out the application. Currrently i am having a single session but i can only open 30 instances of the application at one time. Can it be a setting with ...

26. Hibernate session    coderanch.com

The Hibernate Session is the workhorse that makes your Hibernate applications work. Once a JPA annotated JavaBean touches the Session, the Session will manage its state. You can then update a JavaBean, change its values, and do all sorts of neat stuff, and if the Session is involved, it will persist all of those changes to the underlying database. With a ...

27. hibernate session returning old values    coderanch.com

Hi, I have a Date column in a table which is read by hibernate. Hibernate is executing a query to take all the columns for the field. This gives correct result sometimes and when it is run continously for several times it give wrong value. When I run the query directly in the DB2 control center, it returns the right values. ...

28. Slow Hibernate Session get    coderanch.com

Hi, I have an issue when using the method org.hibernate.Session.get. It only peforms slowly when I add more than a 1000 records to my hsqldb database running on JBOSS. All the steps prior to this line of code are working instantly such 'Session session = mySessionFactory.getCurrentSession()', but when it come to eg 'session.get(arg0.class,arg1)' it takes 9 seconds when obtaining 1 record. ...

29. Hibernate: session.get()    coderanch.com

Hi Every One, I have a doubt about session.get() method.we have different overloaded methods with this name.Like.. public Object get(Class clazz,Serializable id)throws HibernateException and public Object get(String entityName,Serializable id)throws HibernateException In the signature of above methods.. 1. what is id ? Is it the Primary key in our table? 2. what is entityName in the second method ? I have a ...

30. Flushed session in Hibernate - what does it do?    coderanch.com

Hi guys, I have an object that is not detached from the session. When I close the session, I see the following line in the logs: AbstractFlushingEventListener:85 - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects What does that mean? Why does it have the 1 objects in the line? It only happens for the one object. Other log ...

31. Create hibernate session dynamically    coderanch.com

Hi, I have a spring-hibernate GUI application where I show a login screen for user to enter his user-name & password. I have to use this credentials to connect to my database. My database related details are present in hibernate.cfg.xml. My applicationContext.xml has the following entry The sessionFactory is autowired to ...

32. Session maintenance in Hibernate    coderanch.com

33. Hibernate+session    coderanch.com

I 'm working with hibernate and my services are like this one; class MyServicedComponent { public void Buy(string shoesID) { Session session = sessions.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); ExecuteQeury(); tx.commit(); } catch (Exception e){ if (tx != null) { try { tx.rollback(); } catch (HibernateException he) { throw he; } } throw e; } finally { ...

34. Usual problems managing Hibernate sessions... PLEASE HELP?    coderanch.com

I'm writing a web app that is basically a Spring-configured Quartz scheduler. The various Jobs I need to run depend on a seperate Dao package, containing Dao classes that extend Spring's HibernateDaoSupport. These Dao's are all configured in the same ContextConfig as my Quartz jobs,etc. Everything runs smoothly, up until I try to use the Dao methods (findAll, save, etc). At ...

35. Hibernate Session    coderanch.com

Well, when Hibernate loads a JavaBean, it loads all properties associated with that bean, so once the POJO is 'detached' from the Session, all of those properties of the bean are still available. Also, any other POJOs that are associated with that bean through a one-to-one mapping will be loaded as well. So, all properties of a POJO, and all one-to-one ...

36. How to get session of different shard (Hibernate Shard)    coderanch.com

Howdy, Greenhorn. You have to remember that we're all volunteers here. We always try our hardest to help out, but sometimes we get busy, sometimes we don't log in for a while, and believe it or not, sometimes we don't have the answers! Hibernate Shards is fairly new, and certainly isn't as pervasive as other Hibernate technologies. As a result, finding ...

37. EntityManger and Session in Hibernate    coderanch.com

I want something to execute on openSession and closeSession event of hibernate. When Hibernate API is used to persist the object i am able to do it . I have put aspects around openSession() and closeSession() methods and there i can execute my own logic but when Java Persistence API is used to persist an object i am not able to ...

38. [SOLVED] "org.hibernate.Session" ClassNotFoundException    coderanch.com

Hello to all, Despite I added all necessary .jar files to project, I always take boring exception warnings that say "class not found". I added the code and exception output below. I'll be so happy if someone can help me. Thanks in advance.. With regards, T ----------------------------------------------------- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method ...

39. session handling problem - hibernate-JPA    coderanch.com

Hi, I have a problem in connection management. I'm using Hibernate-JPA. I'm creating an entity manager using the entitymanagerfactory. When try to do a load testing, I'm getting the following problem: (Any help will be really appreciated.) <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1270770247781> <[weblogic.servlet.internal.WebAppServletContext@a222cba - appName: 'ServicesEar', name: 'ServicesWeb', context-path: ...

40. help on releasing hibernate session    coderanch.com

Hi All, Im really new to hibernate, its been a week now on lingering through the codes that im handling now. im just using a lower version, i think its 1.1.x right now im cleaning the codes as there are some hibernate sessions which are not closed once a query or update is called. My task was to clear them up ...

41. Same Hibernate session, among RMI calls.?    coderanch.com

Is this possible to use same hibernate session over multiple RMI calls? In my application, these RMI calls obviously involves various method invokes, using load balancer, over different servers, but all of these calls actually being used for originally in a single thread. RMI is configured using Spring. Is there any configuration, which can help to use single hibernate session throughout ...

44. Unable to get hibernate session    coderanch.com

Hi Prasad, I know that because i tried running this code with sysouts and debugged the code as well. But, couldn't understand why it is going to finally from openSession() method. The below is the log.. May 22, 2011 7:08:20 PM org.hibernate.cfg.Environment INFO: Hibernate 3.2.3 May 22, 2011 7:08:20 PM org.hibernate.cfg.Environment INFO: hibernate.properties not found May 22, 2011 7:08:20 ...

45. Hibernate Session Factories from org.springframework.orm.hibernate3.LocalSessionFactoryBean    coderanch.com

Hi All, I need a big favor from you. My application has memory leak problems. I was trying to find out and i see the problem with Hibernate Session Factories. The console is showing that Hibernate Session Factories are created several times. Apparently it is going out of Memory. Below are the logs am seeing. The same logs are continuing my ...

46. Hibernate - Session use    java-forums.org

Hi everybody! I want to ask for your help about using Hibernate to persist an object. There's an error when I try to make some updates. It says that there's a synchronization error with the database o something like that. I think that I'm not using Hibernate or the Session object in a good way. So I want to show you ...

47. Inactive session on databse side while using hibernate    forum.hibernate.org

Hi Everybody, I have used hibernate in my application. I am getting problem as when i log out from the application the session remains inactive and some cursor are open but after some some time the count of cursor and inactive session get reduced. Is there any way so that after logging out the session get completely close. In each method ...

48. Hibernate Session Keep Alive    forum.hibernate.org

Hi there, I have this problem, I'm validating a 40,000 lines CSV and for each line I have to insert in a table a new register. The problem is that these operations ("save") have to be transactional and the Hibernate Session time-out is 100 secs. I cannot change this time parameter and I've made something to keep alive the session so ...

49. Get session variable in the HibernateSessionFactory.java    forum.hibernate.org

Hi all, I'm working on an application in eclipse using tomcat and hibernate, I need to modify it to dynamically configure the class HibernateSessionFactory.java with a session variable (which depends on the user login) It is recoverable in the code of a jsp via this variable: #{sessionScope.utilisateur.datasource} I don't know how to retrieve this variable in this class. :/ If a ...

50. Retrieving current configuration for a session    forum.hibernate.org

Hi keliveli, I'm not really sure but I think you can at most get some configuration details from the SessionFactory that created the Session instance but not on the Session itself. A Session is a lightweight thingy and is created by the SessionFactory according to the factory's configuration, i.e., all Sessions created by a given SessionFactory instance share the same configuration ...

51. Session.get is too slow    forum.hibernate.org

Hi All! I am using the Hibernate 3.2.6GA with Java 6 and I am expiriencing the performance problems by calling Hibernate session.get(class Class, id Serializable) method. I am using EhCache (1.6.0), and I am trying to retrieve already cached objects using session.get method. Here is the piece of test code: Code: private void testCache() { ...

52. Freeze up on reload/session.invalidate    forum.hibernate.org

Newbie Joined: Mon Mar 22, 2010 6:57 am Posts: 6 I an trying to write a webapp from scratch and I encountered this problem using hibernate. When I logout and do a session.invalidate OR I hit F5 to refresh the page, succeeding calls to hibernate results in a lock up. I am using spring 2.5, hibernate 3, and hsqldb 1.8. PLease ...

53. Hibernate Sessions    forum.hibernate.org

Author Message kolobear Post subject: Hibernate Sessions Posted: Mon May 17, 2010 10:42 am Beginner Joined: Mon May 10, 2010 2:00 pm Posts: 21 I am having problems with what seems to be unclosed database sessions. This is causing my websites to stop displaying information from the database about once a day. We are using Oracle 11g as the ...

54. Hibernate Sessions    forum.hibernate.org

55. help on realeasing a hibernate session    forum.hibernate.org

Hi All, Im really new to hibernate, its been a week now on lingering through the codes that im handling now. im just using a lower version, i think its 1.1.x right now im cleaning the codes as there are some hibernate sessions which are not closed once a query or update is called. My task was to clear them up ...

56. Session problems    forum.hibernate.org

Hello, I have a problem with sessions. Here is the code I'm trying to run in the Main method Code: Session s = HibernateSessionFactory.getSession(); PEnforcementOrder order = null; try { ...

57. Session Issue    forum.hibernate.org

58. Static vs Non-Static Sessions    forum.hibernate.org

I've recently taken on the database/hibernate side of our project and am having terrible trouble understanding some fundamentals of our design regarding the use of managed sessions. We have a util class containing a static session that is only initialised once. Retrieval of the session is used by every DAO in the system via a static method getBoundSession(). The application runs ...

59. No session Problem-Upgrade Hibernate 3.1.2 to Hibernate 3.5    forum.hibernate.org

Hi All, While upgrading hibernate 3.1.2 to 3.5.4 we are facing "org.hibernate.LazyInitializationException: could not initialize proxy - no Session" exception while trying to use proxy objects from view layer. We have settings of OpenSessionViewFilter and transactions. We are using it JSF as view layer. Following are complete exception log - org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57) at ...

60. Hibernate session    forum.hibernate.org

61. Problem with sessions    forum.hibernate.org

I am new on this and I didnt know where publish my question... I have a problem trying to insert or update any table: For Example: When I click on INSERT on my web page works fine, it inserts on the table and I can see those changes on the SGBD, but when I am navigating to see the changes, it ...

62. problem with hibernate session    forum.hibernate.org

Author Message malekmorisseau Post subject: problem with hibernate session Posted: Tue Oct 12, 2010 2:38 pm Newbie Joined: Tue Oct 12, 2010 2:19 pm Posts: 4 Hi I have a problem with the session hibernate Quote: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.AbstractSessionFactoryBean$TransactionAwareInvocationHandler.invoke(AbstractSessionFactoryBean.java:299) at $Proxy0.getCurrentSession(Unknown Source) at ...

63. remove obj from session after MySQLIntegrityConstraintVion    forum.hibernate.org

Hi there, Hope you can help me with the following issue. I want to store a number of objects, but after saving one of the objects the session throws a org.hibernate.exception.ConstraintViolationException. No problem, but now I can NOT commit the transaction to store the other valid objects. Can anybody tell me how? How can I remove the invalid object from the ...

64. Stale Sessions in Hibernate    forum.hibernate.org

Hi Friends, I'm developing a web application in Java where i use Hibernate with PostgreSQL. Things are going good, but i have a concern with my approach. I'm not sure if I'm doing the right thing. When a user logs in, I create a httpSession and hibernateSession. I store the hibernateSession as an attribute in the httpSession. I'm not sure if ...

65. ExceptionInInitializerError while creating session    forum.hibernate.org

Hi, I am using hibernate-search with following jars and using annotations for configuration. hibernate-commons-annotations-3.3.0.ga.jar hibernate-search.jar hibernate-annotations-3.4.0.GA.jar hibernate-core.jar lucene-core.jar solr-common-1.3.0.jar solr-core-1.3.0.jar My code snippet: SessionFactory sessionFactory = new org.hibernate.cfg.AnnotationConfiguration().configure().buildSessionFactory(); Session session =sessionFactory.openSession(); FullTextSession fts = Search.getFullTextSession(session); Transaction transaction = fts.beginTransaction(); TermQuery termQuery = new TermQuery(new Term("firstName", "Batman")); BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(termQuery, BooleanClause.Occur.SHOULD); try { //execute the query List contact = ...

66. Session Old Values    forum.hibernate.org

Hi My architecture is Struts 2 with Hibernate. I have the following in my hibernate.cfg.xml to avoid caching false false I get my sessions from Following getSession() method. public static Session getSession() throws HibernateException { Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory(); } session = (sessionFactory != null) ...

67. Session blows up after using Work    forum.hibernate.org

Hi team, I am facing a very strange problem after using session.doWork(Work myWork) with Hibernate (ver 3.5) Basically after successfully executing this command {session.doWork(Work) } to use vanilla SQL and getting result set, the Hibernate goes into limbo state if I tried to use it the second time. Any operation will be dead locked. Any idea? I can go into details ...

68. Session not created    forum.hibernate.org

Hi all, I am new to hibernate and was following up the pdf i got. i use java6 and no web server is used. if i say sessionfactory.getCurrentSession(); the error is "No TransactionManagerLookup specified" and if i say sessionfactory.opensession(); then an error is thrown at session.beginTransaction(); the error is "Could not find UserTransaction in JNDI: " "Caused by: javax.naming.NoInitialContextException: Need to ...

69. ConstraintViolationException shouldn't invalidate session    forum.hibernate.org

Hi, I'm upset about the hibernate handling of ConstraintViolationException. It invalidates the session. I use TRANSACTION_READ_COMMITTED and want to avoid pessimistic locks as much as possible. I have many cases of idempotent get/create for relationships, an example being a category path. For this example, the subpaths have parent/child relationships. I want to set a unique constraint on the db, such that ...

70. More known risks of mixing JPA with Hibernate Session?    forum.hibernate.org

Hi, Several months ago we've taken a decision to use JPA annotations, with Hibernate Session (as opposed to Entity Manager). We read that it's a valid approach, and we liked the idea (we like Hibernate Session because of HQL and because we already have infrastructure code for it; but we wanted to try out JPA annotations). Now I see this warning ...

71. Session's get() retrieves question marks instead of greek    forum.hibernate.org

I have a web application that uses spring and hibernate. My hibernate session factory is configured in spring as: Code: org.hibernate.cfg.AnnotationConfiguration ...

72. Get Session JPA from SessionImplementor Hibernate    forum.hibernate.org

Hi I use JPA with Hibernate3.5 on JBOSS5.1. I developped a new generator for internal purpose. In JPA there is no way to define new generator so I used a implementation of IdentifierGenerator. I configure the generator like this on a entity : @Id @GeneratedValue(generator = "NUOGenerator") @GenericGenerator(name = "NUOGenerator", strategy = "jpa.NUOGenerator") @Column(unique = true, nullable = false) public long ...

73. How to check whether active session under the SessionFactory    forum.hibernate.org

Hi, I am exploring on dynamically modify some tables' structure on runtime. Some expert solutions that I found are to build multiple SessionFactory, and always use the latest factory for latest hibernate mapping. The concept in my mind is to have a independant SessionFactory for each dynamic table, and whenever there is update to a table structure, the app will shutdown ...

74. Contextal Sessions    forum.hibernate.org

75. Traboules with tocate and Hibernate sessions    forum.hibernate.org

Newbie Joined: Mon Nov 14, 2011 4:37 am Posts: 3 Hi ; I am currently developing a JEE application with hibernate and mysql, in total the application works correctly except some days it generates an error this is the portion of the log: Code: -------------sessionCreated---------------2011-10-23 18:00:58 23 oct. 2011 18:05:37 org.apache.coyote.http11.Http11Protocol pause INFO: Suspension de Coyote HTTP/1.1 sur http-8180 23 oct. ...

76. Mutliple Session Factories    forum.hibernate.org

Author Message David2071 Post subject: Mutliple Session Factories Posted: Wed Nov 16, 2011 8:42 am Newbie Joined: Wed Nov 16, 2011 8:34 am Posts: 1 Hi I'm currently using JBPM with persistance (through hibernate) with my own web app that uses its own hibernate db access (Both writes to different db schemas). Everything works fine except that when JBPM ...

79. Hibernate, Session facade and cluster    forum.hibernate.org

My application is designed around Session facade(Session facade id CMT session bean) in each method user gets Hibernate session and after he is done with it(mothod) session is closed in "finally" (this includes session.flush(); session.close()). In cluster few issues raise, how do I work with the same Hibernate session thru the transaction(which could be distributed) if one Session facade decides to ...

80. how to reuse the opened session    forum.hibernate.org

Hi, Can I use the same opened session for update from 1 table and again for querying from another table.I am doing the following and getting 'Connection is busy with another hstmt' dbSession = session.beginTransaction(); Cat Pricess = new Cat(); princess.setName("Princess"); princess.setSex('F'); dbSession.save(princess); dbSession.connection(commit); dbSession.close(); dbSession = session.beginTransaction(); //Logic for querying from some table dbSession.close(); Any Help greatly appreciated Thanks in ...

81. Problem with 2 session factories    forum.hibernate.org

Hi, I need 2 session factories mapping 2 datasources and I got this error message : ERROR [XMLHelper] Error parsing XML: /hibernate.cfg.xml(30) org.xml.sax.SAXParseException: Element "hibernate-configuration" allows no further input; "session-factory" is not allowed. at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(ValidatingParser.java:345) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1317) at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at org.dom4j.io.SAXReader.read(SAXReader.java:339) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:785) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732) at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)[/color] This is my hibernate.cfg.xml ...

82. * should we have Session.result() ?    forum.hibernate.org

1. I'm leaning towards throwing an exception! Returning null when the result is higher than it should be, is in my mind VERY dangerous! It makes no error occur when their actually should. But returning null when the result is really empty is quite alright. And we cannot "swallow" all other exceptions, so one still need to handle database errors, error ...

83. Recommended Session lifespan?    forum.hibernate.org

I am writing a client application which uses hibernate to persist a bunch of objects to an HSQL database. After (re)reading the doc, boards, and faqs I still am looking for a clarification. My app will load a bunch of objects at startup to restore the state. After that there will be multiple threads which will be accessing stuff on the ...

85. add a method to the Session interface    forum.hibernate.org

86. ArrayIndexOutOfBoundsException thrown while building session    forum.hibernate.org

A ProfitCenter.class when added to configuration() thorws the following stack trace : [10/22/03 16:08:01:308 EDT] d782284 SystemErr R java.lang.ArrayIndexOutOfBoundsException: 1 [10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.initPropertyPaths(EntityPersister.java:918) [10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.initPropertyPaths(EntityPersister.java:892) [10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.postInstantiate(EntityPersister.java:113) [10/22/03 16:08:01:339 EDT] d782284 SystemErr R at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:223) [10/22/03 16:08:01:339 EDT] d782284 SystemErr R at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627) [10/22/03 ...

87. Sessions and stateful Session baens    forum.hibernate.org

88. session.iterate() & session handling    forum.hibernate.org

Hi, I'd like some advice on handling session.iterate(). So far my hibernate usage pattern for storing/loading object has been: open session->load/save->close session->return to business layer. Now, I'm adding support for loading large lists of records using session iterate and this usage breaks down as I cannot close the session until after I am done iterating through the result set. Here's my ...

89. Just one session ?    forum.hibernate.org

Is it a viable solution for a standalone Swing application to have just one session for the whole application ? If yes, better static or singleton ? Isn't there any risk that the (single) session gets closed against my will ? Should I use new 2.1rc1 session.connect() and disconnect() methods ? Thanks for your attention!

90. Warnings on Session finalization    forum.hibernate.org

Session sess = factory.openSession(); Transaction tx = null; try { tx = sess.beginTransaction(); // do some work ... tx.commit(); } catch (Exception e) { if (tx!=null) tx.rollback(); throw e; } finally { sess.close(); ...

91. Problem getting Session in 2.1    forum.hibernate.org

I was using Hibernate 2.0.3 with JBoss( Hibernate configured as JMX Bean) which had been running fine. But when i downloaded Hibernate 2.1 and started using it, this problem has started coming up when i am trying to fetch the session from the seesionfactory "net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem" What can be the problem here? Thanks

92. AssertionFailure: possible nonthreadsafe access to session    forum.hibernate.org

Hi, I'm getting this error in my program and don't know why... I have a process implementing the Runnable interface which looks this way: public class PerfectMatcherProcess extends HibernateProcess { protected final ThreadLocal session = new ThreadLocal(); protected void initSession() throws DataException { Session s = PersistenceLayer.getInstance().getSession(); session.set(s); } protected Session getSession() { return (Session) session.get(); } public void run() { ...

93. Confused in the session & trancation    forum.hibernate.org

Newbie Joined: Tue Jan 06, 2004 7:09 am Posts: 2 Mapping file Code:

94. Sporadic "Session is currently disconnected" excep    forum.hibernate.org

Why is the session disconnected? After each interaction from the web frontend via a Struts Action interacting with a DAO class wrapping the Hibernate code, I call close on the Session. I am expecting that each new request from the web client will use a new Session, therefore I am confused as to why Hibernate thinks it is disconnected?

95. Use of session in onSave    forum.hibernate.org

Newbie Joined: Mon Sep 22, 2003 5:43 am Posts: 15 Succinct Problem: When I use an s.find("..") in onSave (Lifecycle) I get the following error: "SQL update or deletion failed (row not found)" Using: hib2.1 with spring managed transactions through intercptors. Is there a limitation to the use of find or the session whilst inside the onSave callback? Verbose Problem: I ...

96. Why is "session-per-operation" an antipattern!?    forum.hibernate.org

The advice is really to utilize a single session instance for a single logical "unit of work". Now the definitions of "unit of work" tend to vary, but the usual strategy is that a unit of work defines a single transaction in terms of database access. In a web app (and web services also) this almost always implies a one-to-one correlation ...

97. Nested sessions    forum.hibernate.org

I am using hibernate and the spring framework... Just included some pseudo code below.. the actually classes are a bit long winded... I am trying to use 2 diff hibernate sessionFactories ( 1 = oracle, 2 = hsql ). Class Foo has members: hsqlSessionFactory, Bar Class Bar has oracleSessionFactory I obtain these factories by having the spring framework 'set' them on ...

98. LESSON LEARNED, - Session managment    forum.hibernate.org

99. Session is currently disconnected    forum.hibernate.org

Hi, I got few good suggestions from this forum on the consequences of building the session factory only once but we were building the factory multiple times. I'm in the process of building the facotry only once and get session from there. I looked at couple of samples and both of them are building the factory initially in Filter and then ...

100. How to correctly deal with Hibernate session?    forum.hibernate.org

hi experts, I have two ways to deal with Hibernate session, 1) To close session before ending each request-response cycle, and open new session before starting the same cycle. 2) Just to disconnect() and clear() session before ending each request-response cycle, and reconnect() session before start the same cycle. Because I still have to reuse the entities and these entities may ...