session 3 « Session « JPA Q&A





1. hibernate session    forum.hibernate.org

Newbie Joined: Mon Aug 07, 2006 7:14 pm Posts: 16 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.0[/b] [b] org.hibernate.exception.GenericJDBCException: could not update: [com.myApp.model.ProcessAudit#3363] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2222) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:951) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:109) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540) at ...

2. ConcurrentModificationException during session.getEntityName    forum.hibernate.org

I am having an issue with calling session.getEntityName(obj) where a ConcurrentModificationException is thrown. This is occuring in some web application code where I am trying to save the objectId and entity name so that I can load the object again later if needed. The process is basically: # load object from hibernate # call session.getEntityName(...) on the same session it was ...

3. Need help with creating Hibernate Session.    forum.hibernate.org

I am very very new to Hibernate and I am going through the Hibernate Documentation trying to follow the exercise using Tomcat. I have a HibernateUtil class that uses the Hibernate SessionFactory for creating Hibernate Session. I have a Cat.java and I have a Test.java that has the code that uses the HibernateUtil to get the Hibernate session to try to ...

4. Two times calling session.creaeQuery()..2nd one is not worki    forum.hibernate.org

StringBuffer clause1=new StringBuffer(); StringBuffer clause2=new StringBuffer(); List changeLogList =null; List changeLogList1 = null; String sortBy=form.getSortBy(); String listOrder=form.getListOrder(); String arItemSkey=form.getArItemSkey(); hibSession = HibernateUtil.getSessionFactory().openSession(); clause1.append("select new fit.gdms.viewbeans.AritemChgLogDTO(u.userEmail,TimeStamp(ar.lastUpdTs),ar.chgItem,ar.oldChgValue,ar.newChgValue) from fit.gdms.schemadao.AritemChgLog ar,fit.gdms.schemadao.UserAccProfile u where ar.arItem.arItemSkey ="+arItemSkey+" and ar.lastUpdId=u.user.userCnum "); clause2.append(" select new fit.gdms.viewbeans.AritemChgLogDTO(u.userEmail,TimeStamp(fr.lastUpdTs),fr.chgItem,fr.oldChgValue,fr.newChgValue) from fit.gdms.schemadao.FcstChgLog fr,fit.gdms.schemadao.UserAccProfile u where fr.forecast.arItem.arItemSkey ="+arItemSkey+" and fr.lastUpdId=u.user.userCnum "); changeLogList1 = hibSession.createQuery(new String(clause1)).list(); changeLogList = hibSession.createQuery(new String(clause2)).list(); ------------------------------------------------------------------------------------- here Hibernate exception ...

5. Hibernate Session Saturation Probleme    forum.hibernate.org

Hello , I'm a new user of Hibernate 3.2 , I have a strange phenome that occures when I run my application .What I'm doing is executing a SQL query via Criteria API , I want to execute the same query x times but with different parameters , It work fine if the number of query don't rich 9 ! and ...

6. SQLQueryImpl.executeUpdate() doesn't set session's flushmode    forum.hibernate.org

I guess it's just related to the default strategy. For example, with FlushMode.AUTO, list() is known to be called after a flush() has been done. This helps you working on a good dataset, if some data are not in the db yey. Though, when updating, I guess Hibernate does not do any automatic flush(), so you have to call flush() by ...

7. Session nulling out in AbstractCollectionPersister    forum.hibernate.org

Hibernate version: 3.1 Mapping documents: Person Code: select * from RELATIONS where TYPE = 8 or TYPE = 9

8. session.get() yields different result than a findbyCiteria.    forum.hibernate.org

Code: TableDefinition refTable = XXXTestData.createReferenceTable(); xxxService.storeObject(refTable); Map criteria1 = new HashMap(); criteria1.put("technicalId", refTable.getTechnicalId()); TableDefinition tb3 = (TableDefinition) xxxService.findByCriteria(TableDefinition.class, criteria1).get(0); TableDefinition tb4 = (TableDefinition) xxxService.getObjectById(TableDefinition.class, refTable.getTechnicalId()); ...

9. Historical Sessions    forum.hibernate.org





10. Synchronizing a Session - how?    forum.hibernate.org

Regular Joined: Tue Sep 28, 2004 5:18 pm Posts: 55 Location: Switzerland First off, I've perused the forums searching for related posts. There are many, this being one of the longest: http://forum.hibernate.org/viewtopic.php?t=925435 I realize that the standard answer to this question is: Don't do it. Indeed, I agree with the reasoning for this recommendation, and would never even think of synchronizing ...

11. Async Session handling    forum.hibernate.org

Hi all, I'm facing jBPM (workflow engine) for the first time (and I'm not an expert in hibernate) and just when I was about to start coding my application, I faced an issue that I couldn't find any answer for the last two days. jBPM uses hibernate. I'm using jBPM-3.1.3 as lib's (jbpm-3.1.3.jar and jbpm-identity-3.1.3.jar) inside my Enterprise Application (.ear) deployed ...

12. What file is import net.sf.hibernate.Session in?    forum.hibernate.org

I'm using Hibernate 3.1 in MyEclipse. I'm trying to include the correct Jar which has import net.sf.hibernate.Session so I can do a "find", but I am having trouble locating this jar. Can anyone please point out which jar this is? (I know this is a really basic question, sorry). Thanks to all in advance! -O-

13. using interface in session.get() ??    forum.hibernate.org

Hellu, I would like to use the interface 'class' in my session.get(), like: - session.get(Myinterface.class, id). I understand that it doesn't work, probably Hibernate needs more information to retrieve this. I get a hibernate mapping exception telling my that ofcourse it can't find the MyInterface class. I had a look at the proxy attribute, but I don't think that is my ...

14. Problem with hibernate session    forum.hibernate.org

Hi, I am using hibernate 3. I am facing some problem with hibernate session.I am loading the data from database,when i delete the record from the list the record is deleted from the database,when i insert the same record(primary key) with different values for other columns other than primary key.It's showing the same values which is in the previous session,but in ...

15. session.isConnected() ?    forum.hibernate.org

Hi All, What exactly does session.isConnected() do? when i call this api on the session object returned from a newSession using sessionFactory.openSession() >>it prints true. does it say whether this session object has a jdbc connection opened? But if so, hibernate doc says that, a connection to a database is obtained and sql statements are triggered only when a transaction is ...

16. Session never dies    forum.hibernate.org

Beginner Joined: Mon Sep 04, 2006 7:18 am Posts: 45 Hibernate version: 3.1 Hello. I have a J2EE application. And sometimes when I execute a query, the query just keeps going and going, it doesnt stop. It can be a simple query like getSomethingById And then I will have to close the browser, and then when I try to execute the ...





17. Session no longer connected    forum.hibernate.org

We have an app with a single long lived session. When we want to do something, we - get the session instance - check if the session isConnected and isOpen - beginTransaction - do stuff - commit or rollback Intermittently ( and very infrequently ) the isConnected check fails. Why would a long running session suddenly become disconnected? Is it actually ...

18. Session.getNamedQuery and SQLQuery.    forum.hibernate.org

19. Issue with the use of 2 sessions.    forum.hibernate.org

Hibernate version: 3.1.3 Hi, I am having some problems with the use of 2 different sessions. Let's say that I have an object that has a property set to the value "1", I retrieve this object in the first session and have it detached. In another session, I retrieve this same object, set its value to "2" and save it. It ...

20. handling session    forum.hibernate.org

Hi, We are developing a web application which uses hibernate for data persistence. There is a confusion regarding when to open and close hibernate session. We are planning to use JNDI bound session factory. Is it a good practice to call sessionFactory.openSession() within the methods in the DAO class and call session.close() in the finally block in those methods? I have ...

21. Is UserCollectionType possible with Dom4j session?    forum.hibernate.org

Hibernate version: 3.1.3 Full stack trace of any exception that occurs: Exception in thread "main" java.lang.ClassCastException: com.example.MyPersistentBag cannot be cast to org.dom4j.Element at org.hibernate.type.CollectionType.setToXMLNode(CollectionType.java:552) at org.hibernate.property.Dom4jAccessor$ElementSetter.set(Dom4jAccessor.java:310) at org.hibernate.tuple.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:330) at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.loadCollection(Loader.java:1919) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676) at org.hibernate.type.CollectionType.getCollection(CollectionType.java:507) at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:341) at org.hibernate.type.CollectionType.resolve(CollectionType.java:335) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at ...

22. How do I handle session.getConnection().isClosed() ?    forum.hibernate.org

If suppose in my application; db connection got closed ( due to any reasons like DB got restarted OR mysql timeout of 8 hrs over so mysql closes the connection) . Now if I do sess.isOpen() or sess.isConnected() both returns true but sess.connection().isClosed() returns true... I am using current_session_context_class as thread. So, how do I handle this ? I mean before ...

23. Session clustering    forum.hibernate.org

Hi, We are trying to implement Session Clustering using Spring & Hibernate deployed on Oracle10gAS 10.1.2.0.2. There are two OC4J servers configured for session clustering. On fail over request is successfully going to another one. For simple plain JSP application HTTP session build on first machine is available on second oc4j machine. But session clustering is not working fine with application ...

24. Why doesn't StatelessSessionImpl implement Session?    forum.hibernate.org

I'm converting an OracleForms application to a Java web application. Due to the structure of OracleForms, I'd like to use Hibernate's StatelessSessionImpl class instead of SessionImpl as the Hibernate Session implementation. We are also using the Spring Framework to configure Hibernate. Since I'm using the Spring Framework's HibernateTemplate and OpenSessionInViewFilter, it is not easy to setup my DAO code to use ...

25. Synchronizing two hibernate sessions    forum.hibernate.org

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 ? This ...

26. Sessions in Fat Client Apps    forum.hibernate.org

Problems with Session and transaction handling? Yes I do. Read this: http://hibernate.org/42.html Done. I understand the problem, but I don't know the solution. Therefore I hope somebody here can help me. I am working on a Swing application, with simple JDBC transaction handling. Therefore I have my objects lying around for a long time, which causes problemes: 1. A user creates ...

27. Hibernate Session help    forum.hibernate.org

Hibernate Session Help. I am encountering a problem using the same session for Retrieving multiple objects, but just committing one object to the database. Here is a sample: 1--> There are two Classes * Person (id, Name, DOB) and * Shop (id, Name, Location, PersonInCharge) 2--> There is no relationship defined between these two classes. 3--> Open a new Hibernate Session ...

28. Session-specific statistics    forum.hibernate.org

Hibernate version: Hibernate 3.2.2 GA Name and version of the database you are using: MySQL Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2 I know Hibernate offers plenty of statistics for the session factory, but I was wondering whether it is possible to get a hold of similar information for one single session. More specifically; I'm asking about the ...

29. Sessions in hibernate.    forum.hibernate.org

30. session.repliate()    forum.hibernate.org

31. Tracking all SQLs by Hibernate on each Session    forum.hibernate.org

Hi everyone, I am trying to figure out a way to track all SQLs and their execution times inside each Session. I know about log4j's org.hibernate.SQL and the statistics listener but those options don't seem to do the trick for me. I am trying to come up with some kind of monitor which will log all SQLs executed on a Session ...

32. session.getConnection() deprecated?    forum.hibernate.org

When it says it's deprecated, that doesn't mean it won't work, necessarily, just that it's not recommended anymore. Technically, it might go away in a future release, but that seems unlikely to me. When you say "custom SQL", note that you can still use a raw SQL query in the regular Hibernate interface. There are other things you might still need ...

33. Sessions with different ConnectionReleaseMode's    forum.hibernate.org

34. valid session from daoImpl    forum.hibernate.org

Author Message jiml Post subject: valid session from daoImpl Posted: Wed Nov 14, 2007 12:47 pm Newbie Joined: Wed Mar 09, 2005 10:15 pm Posts: 10 hi All... Within my daoImpl class, I'm trying to run a sql query but it seems like I'm not getting a valid session. I tried using a callBack and without but the same ...

35. when to start and end a session?    forum.hibernate.org

Hi all, I have a lot of persistent objects that must be loaded, edited and then saved thru a GUI. Actually, all my objects have a load and save method that performs SQL query against a database, performing an hand-crafted bmp. Now I'm moving to hibernate, and I'd like to know if I should start the session when I load all ...

36. Session Notifications - Do They Exist?    forum.hibernate.org

Is there a way to notify all open sessions that an object in its cache is outdated? For example, session 1 changes a Cat object, and session 2 has the previous version of Cat cached. Is there a way to let session 2 know that the Cat object needs to be reloaded? It would be great to have some sort of ...

37. handling sessions question    forum.hibernate.org

Hi, I am having trouble to figure out what is the right thing to do. This is my case: I am creating an object with 1 session and saving it into the db. I am holding it somewhere in the application too, and then later in the time, other session updates it (it got versioning and everything is good) But the ...

38. Hibernate sessions    forum.hibernate.org

Hi All, regarding hibernate session object a small query, Is session object is always connected to database. i mean when we say getSessionFactory.openSession() it should be making connection but when it gets closed until some one calls session.close()???? as in .Net there is concept of DataSet,it can be configuered as connected/disconnected architecture.

39. hibernate session    forum.hibernate.org

40. how hibernate sessions work?    forum.hibernate.org

41. problem with session?    forum.hibernate.org

42. "SET ARITHABORT ON" ON HIBERNATE SESSION before ex    forum.hibernate.org

I have done this successfully -- at least setting ARITHABORT to ON. I haven't tried turning it off, but I don't know why it would ever be necessary to do so. We had the same need to enable ARITHABORT so that we can use indexed views... indexed views are about three times faster for our most common queries so turning on ...

43. session.get()    forum.hibernate.org

44. piggyback StatelessSession on normal Session    forum.hibernate.org

i have a somewhat unique requirement in that i need to perform some batch processing within a process that also has normal business logic. ive searched the forums countless times for other scenarios using the StatelessSession but i dont see anything particularly helpful..thus im asking in a new thread. i apologize in advance for the long comment but im trying to ...

45. Please explain this behavior of session    forum.hibernate.org

I could understand the following behavior of the session when i wrote some code to experiment with session's transactions. I listed my scenarios #2 is the actual question. 1)First i got session using sessionfactory.opensession() and with out beginning a transaction i saved a entity and then flushed and closed the session , obviously the data is not persisted and cannot be ...

46. managing session hibernate    forum.hibernate.org

Good morning, I go directly to the heart of the problem, I work on a web application with struts and hibernate, when I log on two page of the same post and is working on the same type of items I have a problem of competition for access to data. plz if someone can help me find a solution I will ...

47. session question    forum.hibernate.org

hi all, i'm fairly new to hibernate and have a question on sessions. i'm using hibernate to point to multiple db instances. all instances have the same schema definition for the persisted object. so, i've defined my create method like this: Code: public Employee create(Employee employee, SchemaInfo schemaInfo) { Transaction tx = null; ...

48. Session Problem    forum.hibernate.org

Hi All, I'm having some problems with function session.openSession() It doesn't open any session!? Here is the code I have at the moment: The currentSession() is called from listUser() function. public static Session currentSession() throws HibernateException { Session s = session.get(); //Open a new Session, if this Thread has none yet if (s == null) { s = sessionFactory.openSession(); <-- here ...

49. Session Problem    forum.hibernate.org

Hi All, I'm having some problems with function session.openSession() It doesn't open any session!? Here is the code I have at the moment: The currentSession() is called from listUser() function. public static Session currentSession() throws HibernateException { Session s = session.get(); //Open a new Session, if this Thread has none yet if (s == null) { s = sessionFactory.openSession(); <-- here ...

50. Getting NamedQuery definitions without a session    forum.hibernate.org

Is there any way I can access a Named query without obtaining a Session? Normally you'd do that like this: session.getNamedQuery("queryName"); But I don't even intend to call the query, I just need to know if it is there, or find out some metadata about it. I didnt find anything in the ClassMetaData objects. Where do I need to look? best ...

51. Multiples Persitence Unit in same Hibernate Session    forum.hibernate.org

org.hibernate.ejb.HibernatePersistence java:/dpjwDS META-INF/orm_dpjw.xml org.dpjw.base.domain.Check (...) org.hibernate.ejb.HibernatePersistence java:/dpjw_office META-INF/orm_dpjw_office.xml ...

52. StaleObjectStateException within same session    forum.hibernate.org

Try to use StaleObjectStateException to prevent current modification. It worked however but broke my existing code. I am doing two thing within one method, say foo(params...){ ... //do a save, so as I can get the id to be used in anotherMethod() save(ccCase); // anotherMethod(ccCase.getId()); ... } The problem is within the anotherMethod() I am doing a findByExample() call. Hibernate does ...

53. Session and c3p0 problem!!    forum.hibernate.org

Newbie Joined: Sat Oct 11, 2008 7:28 am Posts: 10 Location: New Delhi (INDIA) Hi Friends, I am a newbie to hibernate. Please consider the following info first: Hibernate version:3.1 Mapping documents: Code: ...

54. QueryExecutionCount per Session    forum.hibernate.org

55. Problem with results when using different sessions    forum.hibernate.org

Hi, I'm using per-thread hibernate session (ThreadLocal) but additionally i'm saving the session to http-session so what i am actually getting is a per-http-session hibernate session. I've the hibernate session's flush mode set to FlushMode.COMMIT so every time i perform any operation it is immediately updated to the database (after the transaction commit). I can see the updated records, so the ...

56. Which is the more suitable session handling mechanism?    forum.hibernate.org

Hi, i have a problem on finding the more suitable session handling mechanism acording to my needs. I first created a class that returns a thread-safe hibernate session. It is a copy of JPA PersistenceService class, i'm not using JPA but just hibernate. But to solve the problem of performance i put my thread-safe session into http-session so i can share ...

57. problems with sessions    forum.hibernate.org

hi there! i have a problem with hibernate sessions. i have a webservice: in my client side, i read from a database and i build an hibernate object. after that, i send my hibernate object to my service side, wich has other database. my problem is the hibernate session is the same. my code is like this: my session factory: Code: ...

58. How to pass information within Hibernate Session    forum.hibernate.org

I am using Hibernate 3.0 with JTA scoped session context (using getCurrentSession). I am storing a userId and transactionId in a as thread local variables. Using my own ConnectionProvider, I am pulling these variables from thread local and calling a stored procedure on the connection to set the database session identifier, before giving the connection to Hibernate. My issue is that ...

59. Strange "session" Problem    forum.hibernate.org

Hi everyone, I have a strange problem and I'm quite sure that it's easy to solve. I'm using spring + hibernate framework in our application and i think something is missing in the picture. Here's an example. When I log in to our application from my desk top (PC1) as myself and log in to another PC (PC2) with another log ...

60. Strange "session" Problem    forum.hibernate.org

Hi everyone, I have a strange problem and I'm quite sure that it's easy to solve. I'm using spring + hibernate framework in our application and i think something is missing in the picture. Here's an example. When I log in to our application from my desk top (PC1) as myself and log in to another PC (PC2) with another log ...

61. Adding to a non-initialised PersistentSet out of session?    forum.hibernate.org

I have a problem. I need to add an object to a set belonging to a persistent object to take advantage of the cascade="save-update" on it. The set however was not used when the persistent object was in session, so it is just a proxy (non-initialised) and I get a LazyInitializationException, which is natural. I don't want the set to be ...

62. How to implement Stateful Sessions in Hibernate    forum.hibernate.org

Hi, I am new to Hibernate and want to know how can we create Stateful Session in Hibernate without Using EJB's. Is this Possible in Hibernate and where can we find infomation regarding this as i have searched in Google but i have not found anything as of now. Thanks in Advance

63. Session unlock    forum.hibernate.org

64. upgrading hibernate 2.1.8 to hibernate 3.1: classic session    forum.hibernate.org

Hi everybody, I'm migrating an application from hibernate 2.1.8 to hibernate 3.1, and need to keep the use of the "old" sessions, by using org.hibernate.classic.Session The problem is that I can't find a factory to create and get these sessions : The SessionFactory I can use generate and return a session of org.hibernate.Session, which is not convertible to a classic.Session. Any ...

65. JPA portable retrieval of Hibernate's Session from EntityMan    forum.hibernate.org

hi, I have the following dependencies: Hibernate, Hibernate-EntityManager and OpenEJB latest implementation. In one of my Container Managed Dao implementations I have the snippet below which is the way to get the underlying Hibernate Session from the EntityManager injected by the container (note the double level of indirection 2x getDelegate). My question is how portable is this code? if I wish ...

66. Sessions in EventListeners    forum.hibernate.org

...

67. Can't get Session on client    forum.hibernate.org

I'm trying to get Hibernate to work on a Swing client but I fail. When I try to return the Session from the application server (Weblogic 8.1 SP6) to the client I get a stacktrace in the client logs. There are no stacktraces on the server. Any thoughts on what might be wrong? Hibernate version: 3.3.1 Full stack trace of any ...

68. Wrapper over session    forum.hibernate.org

Hi, I am writing a framework. I want to hide few methods of session interface like session.beginTrasaction() from the developers. I want to provide a wrapper over the Session, but not sure how to do it. Session is generated by SessionFactory. Do I have a control here so that I can provide a thin wrapper over this implementation. Any pointer's will ...

69. inspecting sessions    forum.hibernate.org

70. possible nonthreadsafe access to session    forum.hibernate.org

session.update(parent); //add new child to the parent object Child c = new Child() .... parent.addChild(c); ... session.clear(); // session is cleared or closed and another session opened session.update(parent); session.evict(parent); // at this moment the session should be empty? session.flush(); // throws an exception. why ?????? => org.hibernate.AssertionFailure: possible nonthreadsafe access to session

71. hibernate template and session    forum.hibernate.org

Hi i'm wondering about hibernatetemplate and session if we look at those two example: ------------------------------------------------- this is some example about session: Query query = session.createQuery("select myrecord from " + "com.shoesobjects.MyRecord"); getHibernateTemplate().find( "from MyRecord where product_id=? ", productId); ------------------------------------ It is very easier and cleaner to work with hibernatetemplate, and i'm just wonder about what is advantages to use hibernatetemplate and why ...

72. Beginner question about Hibernate Session    forum.hibernate.org

Hi all ! I'm writing a Desktop application which uses Hibernate for querying DB Objects. I have a manager class which Starts an Hibernate Session and returns the Objects to the application: Code: public static List findRoot() { Session session = SessionFactoryUtil.getSessionFactory().getCurrentSession(); ...

73. question about contains method from Session    forum.hibernate.org

hi, i have a question about, in particular i'd like to know, whether i do understand the purpose if this method correctly. a Session is a first level cache and it memorizes the objects that working with the session (are associated with the session). if i want to associate an object twice i get the NonUniqueObjectException, if i use a transient ...

74. OptimisticLockException within a single session    forum.hibernate.org

Author Message Dieter.Moroff Post subject: OptimisticLockException within a single session Posted: Mon Jul 13, 2009 4:53 am Newbie Joined: Mon Jul 13, 2009 4:40 am Posts: 1 Using Hibernate with JPA a create and update the same object twice in a single session. Doing this for the second time I'll get a OptimisticLockException. How can this happen, I tought ...

75. problem with hibernate session    forum.hibernate.org

Hi, i am using Struts 1.2.9 and Hibernate 3 my problem is that i update/add objetcts, but i cant see this modifications i give an example: i have a table Incidents(id, title, description, date, #levelId, #stateId, #createrId) i add a new Incident, or update an old one, when i want to display this one i can see new values of (title, ...

76. How to get session of different shard (Hibernate Shard)    forum.hibernate.org

Hi All i want to get session of different configuration file so i can fire SQL query on that database. Code: 1 public SessionFactory createSessionFactory() { 2 Configuration prototypeConfig = new Configuration().configure("shard0.hibernate.cfg.xml"); 3 prototypeConfig.addResource("weather.hbm.xml"); 4 List shardConfigs ...

77. Session Expiry in Hibernate    forum.hibernate.org

Hello All, Is there anything called expiry of session in hibernate. I mean the session object. Can it expire.? Or can the connection expire. I tried out putting 1 in the configuration file and used a thread.sleep for some 3 hrs and then i made a session.save for an object in my java code. There was no exception . The ...

78. Handling Session    forum.hibernate.org

Hi, I have 2 applications that use the same database, one is the application for the Administrator, where all the configuration is done. The second application is where the users take examens that the Administrator assigned. The 2 application are in separated wars. The problem is that if the Administrator in his application assign a Exam to a user, the change ...

80. The Sessions's EntityPersister & IdentifierGenerator    forum.hibernate.org

I'm building a Hibernate (3.4.0.GA) web-app using Mystic Paste as a template (the source is available at http://kenai.com/projects/mystic-apps ). The Mystic Paste objects save fine, but my objects do not. I've discovered that the problem occurs in org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(). The problem is at lines 129-131, which say Code: 129. else if ( generatedId == IdentifierGeneratorFactory.POST_INSERT_INDICATOR ) { 130. return performSave( ...

81. Couple of problems with Session    forum.hibernate.org

I cant seem to figure out why the following problems are happening... Here's what I am trying to do: I am running a paint panel where I can draw whatever shapes i want in it and the Session will only save when user saves the work - so basically a Session can last a while without being committed. There are side ...

82. hibernate session problem    forum.hibernate.org

hi all i have a problem with hibernate . i have a person object and many relations between it and some other object(its children). when i load a saved child and change it and again save it all thing is good and changes apply to DB but when i want to load that changed person's child hibernate load old object not ...

83. About Contextual Sessions    forum.hibernate.org

Hi all, I am new bie to Hibernate and going thru Hibernate documentation 3.1.1 , At chapter 2 , I got doubt at Contextual sessions. I gone thru a couple of times and following are some of my doubts. 1) difference between jta , thread and managed sessions in hibernate 2) difference between org.hibernate.context.JTASessionContext and org.hibernate.context.ThreadLocalSessionContext hoping for your immediate replies. ...

84. problem when using session-per -reqest in Hibernate    forums.oracle.com

I have an web application running under JBoss(4.0) server. i am using Hibernate to access database. @Deatails of MyAPP: To process a request, my application will go thorough above 50 DAO's. For each request there so many updates/Insetrs/delete/selects, and some of them are related to the results from the latter query results in the same request. So many requests will arrive ...