session « Insert « JPA Q&A





1. recover Hibernate session state after a failed insert    stackoverflow.com

The following code tries to insert an Item object to the db, using Spring+Hibernate. The Item has an Integer id field as primary key, as well as a name column which ...

2. Does session.save() do an immediate insert?    stackoverflow.com

...or does it wait until the associated transaction is committed? I'm using an HQL query in a loop like this:

tx.begin()
for(...)
{
    session.getNamedQuery(...).list()
    ...
   ...

3. Insert not visible from session    forum.hibernate.org

Hi, I'm having a problem when working with threadpools. An insert is executed in the database, session is closed after that, and another thread (that executes AFTER the mentioned session is closed) with his own session tries to read the row inserted, by id. But I get no results for the mentioned id... If I execute an SQL query in the ...

4. Session closes while I am inserting data    forum.hibernate.org

Hi everybody, I am facing a strange Hibernate behavior, I think due to session timeout. I have to insert a lot of data into the database. The insertion works for the first entries, but a a certain point I get an org.hibernate.SessionException: Session is closed! exception. My insert method works in the following way: I get a session from a sessionFactory ...

5. Delete and insert in the same session?    forum.hibernate.org

Hi, I have a method that updates the object X (Train with passengers) that is a parent to its children (passengers). When I update object X (Train) I execute session.saveOrUpdate(plane) for object X (this successfully updates object X), then I want to delete all of its old children and re-insert the new ones (as the children could have changed in meantime). ...

6. Multiple Insert/Update and Delete in one session    forum.hibernate.org

Hi, I have read a few posts where people have discussed the need to use JDBC to do mutiple inserts/updates and deletes within the same session. Has anyone done benchmarks on the threshold (i.e. number of transactions) where JDBC becomes more condusive than using a Hibernate session? I have a few administrative screens in my application where permissions are assigned to ...

7. insert multiple object 1 session    forum.hibernate.org

Hey all, I can't add mapping files here as it's forbidden by the client. But i can give a general overview I have class 1 that can contain multiple class B's . Upon insertion off my first class, i get the NonUniqueObjectException. And truly if i look into the object i see that the Class A contains 2 classB's but they ...

8. Session.save / not working / empty insert    forum.hibernate.org

Hello all. I am trying to use the Session.save(Object o) / Session.saveOrUpdate(Object o) function. I am passing all the parameters correctly, and getting no exceptions. However, there is is no record in the DB pertaining to the insert. Has anyone else come across this? I'm including my SQL, hbm.xml, and Java code, just in case I've missed something. SQL: Code: CREATE ...

9. insert and delete in same session    forum.hibernate.org

Shure, its very simple: I upload a File and insert it into my database (the filename). I do this to name the uploaded file after the id of the inserted object. Then i do certain checks like file size and file type. If the uploaded doesnt pass my checks i have to delete the database entry. Everything works except of the ...





10. insert/delete multiple record with session.save/session.dele    forum.hibernate.org

Be happy, if i hava a collection of objects(in Vector ) and i wanna to save in DB using the following code Bill obj ; << code for opening session and transaction for (int i = 0; i < totalBillingSummaries; i++){ obj = (Bill) dbBillingSummaryList.elementAt(i); session.save(obj) } tx.commit etc. its create only one object(row) in db where as there are 4 ...

11. insert/delete multiple record with session.save/session.dele    forum.hibernate.org

Be happy, if i hava a collection of objects(in Vector ) and i wanna to save in DB using the following code Bill obj ; << code for opening session and transaction >> for (int i = 0; i < totalBillingSummaries; i++){ obj = (Bill) dbBillingSummaryList.elementAt(i); session.save(obj) } tx.commit etc. its create only one object(row) in db where as there are ...

12. session.update(object) produces SQL INSERT    forum.hibernate.org

Hi, I have a very very odd error that does occurs on our live server every 3-4 days and we could not replicate. I create and persist an object (Person) to the database. User are then taken to the external payment system (WorldPay) and I use session.update to update Person with transaction ID and other stuff. It looks like that every ...

13. Session.save generates one insert and four updates    forum.hibernate.org

Author Message Juha-Matti Valjus Post subject: Session.save generates one insert and four updates Posted: Tue Jan 30, 2007 8:43 am Newbie Joined: Tue Nov 28, 2006 3:24 am Posts: 11 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.2.0 GA Mapping documents: A.hbm.xml Code:

14. problem in bulk insert with stateless session    forum.hibernate.org

Hi, I am using bulk insert for saving 100s of objects I get per second. I really liked stateless session for doing this job. But the problem is, my objects are having collection maps which are ignored while saving the objects. I know its a known behavior, but is there any work around to make it work with an object with ...