database « Delete « JPA Q&A





1. Hibernate cascade delete not working    stackoverflow.com

I am having an issue with a delete I am trying to do in Hibernate. Everytime I try to delete I get an issue due to child records existing so ...

2. Problems deleting data from database    stackoverflow.com

I am using Hibernate to access my database. I would like to delete a set of fields on function of a criteria. My database is PostgreSQL and my Java code is:

public ...

3. Hibernate - Can't delete from database!    coderanch.com

I'm using the following code to delete a "Project" with the id of 10: public void deleteObject(V exampleObject, Integer id) { Session session = HibernateSessionFactory.currentSession(); V hibernateObject = (V) session.load(exampleObject.getClass(), id); session.delete(hibernateObject); } In the logs: DEBUG [main] (DefaultLoadEventListener.java:153) - loading entity: [com.loomis.project.Project#10] DEBUG [main] (DefaultLoadEventListener.java:230) - creating new proxy for entity DEBUG [main] (JDBCContext.java:213) - after autocommit DEBUG [main] (ConnectionManager.java:341) ...

4. Hibernate deleting from and reordering a DB    coderanch.com

Ok so im having a world of trouble at the moment with my DB and hibernate (also this may be very obvious but im new to hibernate). i am working with the current table structure below, which i know isnt great but that what ive been given. Im trying to delete elements from my database and have them cascade down and ...

5. [JPA 2.0] Redoploying app deletes my database?    coderanch.com

Hello all, I'm using Glassfish v3 as app server, Java EE 6 Web, JSF and EclipseLink (JPA 2.0). My project was working just fine, redeploying was no problem, even if I deleted a table from my database EclipseLink would regenerate it without any hassle. But now when I drop a table from my database it will give me the following error: ...

6. secondaryTable support for DB cascade delete    forum.hibernate.org

We have an Entity that has a secondary table. We have specified on cascade delete in the database. Currently when the entity is deleted in Hibernate we get org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction Is there any way to tell Hibernate that the secondary table will be cascade deleted so it will not try and delete it? Thanks ...

7. Soft Delete from db    forum.hibernate.org

Hello, I have a question about delete. We would like not to hard delete records in the db. We just need to mark records as inactive if we delete them. At DAO we can implement delete as update status=inactive. The question is in parent/child situation, how can we make child soft deleted also? I am new to Hibernate, any help is ...

8. Hibernate Deleting Objects from Oracle DB failing    forum.hibernate.org

The problem rests in the fact that everything goes smoothly and the log looks great, like everythig is perfect and then I go to the DB and the records haven't been deleted, I don't care how stupid the error is, someone please point it out, as I am about to take my own life over this. Hibernate version: 2.1.6 Mapping documents: ...

9. Can't see change in database after delete    forum.hibernate.org

Beginner Joined: Thu Jan 22, 2004 6:16 am Posts: 40 Location: Luxembourg Even though the session deletes 4 objects, no changes are seen in the database after the commit. I have read the FAQ concerning this, and for me it seems like soing exactly as told.Ideas ? [code] for ( int i = 0; i < res.size ( ); i++ ) ...





10. Can't see change in database after delete    forum.hibernate.org

Beginner Joined: Thu Jan 22, 2004 6:16 am Posts: 40 Location: Luxembourg Even though the session deletes 4 objects, no changes are seen in the database after the commit. I have read the FAQ concerning this, and for me it seems like soing exactly as told.Ideas ? [code] for ( int i = 0; i < res.size ( ); i++ ) ...

12. session.delete but the data are still in the db    forum.hibernate.org

OK, well I think I see a problem. You create a NEW object "Seller" then try to set the ID to 1024. I think Hibernate thinks you just created a NEW record in the database table. You probably have to GET the Seller object using a createQuery or createCriteria. Then, once you have a presistent object, you can delete it from ...

13. How to delete Database tables using Hibernate    forum.hibernate.org

15. dont delete physically in the db, but flag as DELETED    forum.hibernate.org

All my tables have a column 'status' which can be set to DELETED - since a cannot for some purposes erase the entries from the db. My approach is when i read objects with hibernate from the database i always specify a where "status!=deleted" clause. this works fine specialy for collections which are read from association-tables e.g. User has n Groups. ...

16. Could not synchronize database state with session (delete op    forum.hibernate.org

Newbie Joined: Mon Nov 06, 2006 9:46 am Posts: 10 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp i am trying to perform some delete operation as follows.Actually it worked when i tried first .But now "Could not synchronize database state with session" ..this exception raising .I will give the code and exceptions below private void deleteContact(CustomerContactDeleteForm customerContactDeleteForm,GDMSUserDTO roleUser) ...





17. Deleting/Updating over an Oracle database link    forum.hibernate.org

18. Hibernate deleting from and reordering a DB    forum.hibernate.org

Ok so im having a world of trouble at the moment with my DB and hibernate (also this may be very obvious but im new to hibernate). i am working with the current table structure below, which i know isnt great but that what ive been given. Im trying to delete elements from my database and have them cascade down and ...

19. How can I use DB cascade delete in Hibernate?    forum.hibernate.org

I have a hierarchy of classes with a single table per hierarchy but with joined secondary tables. Legacy DB schema has tables with cascade on delete. Therefore, to delete a record for a child it was enough to delete the associated record for the parent. My question is how to tell Hibernate to use this feature? To illustrate it, I created ...

20. update is not deleting objects from collection in db    forum.hibernate.org

I have obj which has set in it. Code is updating set with addition and removal of objects. Adding works fine with database but remove element from collection and calling save is not deleting element from db. I am not getting any exception too. Code is as follows: Set currentOrgs = center.getOrgs(); Organization org = orgDAO.getOrg(10); //this org exists in currentOrgs. ...

21. Enable on-delete-cascade in database    forum.hibernate.org

22. A real db newbie question on deleting referenced entities    forum.hibernate.org

EntityA has a @ManyToOne reference to EntityB. Deleting a B causes a Integrity constraint violation unless I remove any reference to it in any A's. Is there any annotation magic that will let me delete B's and have the A references automatically cleaned up? Or must I load the A's and remove the association? If the latter can you tell me ...