delete 1 « Delete « JPA Q&A





1. hibernate deletion    stackoverflow.com

i have a course object. The course object has a set of tutorials and a set of applications. When i delete a course objects i want the assocated set of ...

2. not able to delete    stackoverflow.com

Hi I am able to add record but not able to delete record. It gives the following error:

[ERROR] 2010-02-20 13:38:16 (JDBCExceptionReporter.java:logExceptions:78) ORA-02292: integrity constraint (BANKNET.FK_DDA_DEAL_ADVISOR) violated - child record found
[ERROR] 2010-02-20 13:38:16 ...

3. hibernate and delete all    stackoverflow.com

What is the best way to delete all rows in a table in hiberate? If I iterate over a collection and call session.delete() It's not performing to my knowledge. If I use another ...

4. is there delete orphen in JPA    stackoverflow.com

I have group and user where group must have an owner otherwise he couldn't exist in hibernate in order to achieve this outcome I do :

@ManyToOne
@org.hibernate.annotations.CascadeType.DELETE_ORPHAN
private User owner;
(inside my group entity) my ...

5. JPA/Hibernate - Prevent deletion in PreRemove handler?    stackoverflow.com

The question title basically says it all. Is it possible in JPA/Hibernate to gracefully prevent the deletion of an entity from the database? What I would like is to ...

6. Create a file and then delete in java    stackoverflow.com

My requirement is there is an export button,onclick the data in the database is loaded and then converted into a .csv ,.doc or .html file ,which can be opened or ...

7. delete in hibernate    coderanch.com

hi all, Am getting error while deleting using HQL(hibernate 2.8). error is 'query must begin with SELECT or FROM ' I am wondering whether hibernate supports a very basic functionality like delete?? but I am sure in 3.0 it do supports all kinds of delete. Please let me know if any body came across these error. Thanks

8. hibernate delete    coderanch.com

9. Using hibernate delete    coderanch.com

Sorry for not being clear. If I had the following mapping... then while trying to delete the object with only "id" value set, complains that the not-null values for cost and size has to be set... org.hibernate.PropertyValueException Original message: not-null property references a null or transient value: ...





10. Hibernate Delete Problem    coderanch.com

Hi, I am very new to the hibernate and I am facing some problem while deleting an object. I have two tables : one is Person and other is Charge and their mapping is as follows: ------------- and ---- ...

11. Hibernate delete    coderanch.com

Let's say I have 1000 records in the database already, with IDs automatically generated by Hibernate incrementally when the objects being persisted into the database. However, there is no guarantee that the first record has an ID=1, it could be any numeric value. Now for example if I want to delete the first 400 records, how should I address this operation ...

12. Which hibernate property is causing the existing data to be deleted?    coderanch.com

Hi there, This is in relation to my previous post (re: hibernate.hbm2ddl.auto) but I thought to start a new thread and present the question in a different way. Maybe "hibernate.hbm2ddl.auto" has nothing to do with the issue I have. The issue is that when I run my main method to test this simple Hibernate sample, all existing data in the table ...

13. hibernate:many-to-many: hibernate deletes too much    coderanch.com

So here's the deal, I have a 3 tables, test, test2, and test_test2_join (the association table between test and test2) hibernate is doing its thing and when I have objects from test and test2 that are related, it automatically puts a row in the association table. Its great. The problem is when I delete a row. Here's a junit test that ...

14. Hibernate Delete Design    coderanch.com

Hi everyone, I must implement a delete sql like that; delete clause can take three parameters or none, in other words if I want to implement each of them one by one, I had to write 8 query like delete from MYTABLE where a=:a delete from MYTABLE where b=:b delete from MYTABLE where c=:c .... delete from MYTABLE where a=:a and ...

15. Hibernate Delete    coderanch.com

16. Hibernate 3.3.1 - Delete doesn't work    coderanch.com

Hi, I am new with Hibernate and encountered an issue, I will describe it through a short example because the involved classes and tables are parts of a very complex project from where is a little difficult to take out the code. In the project Hibernate 3.3.1 is used. We have 2 tables: ParentTable and ChildTable. ParentTable has: Parent_Id (primary key) ...





17. Deleting Current Data on Startup ??    forum.hibernate.org

Newbie Joined: Mon Nov 02, 2009 6:14 am Posts: 2 Hi All, Hibernate newbie here, I've set up a Spring-MVC web app and plan to use hibernate as well. I've sort of have it all working. The application starts and I can add things into the database and fetch them, however when I start the application hibernate deletes all the current ...

18. delete problem    forum.hibernate.org

Author Message EmirEmir Post subject: delete problem Posted: Mon Dec 07, 2009 5:35 am Newbie Joined: Thu Dec 03, 2009 5:07 pm Posts: 2 je veux supprimer une occurence de la table BCN dans la base de donnes Hibernate a cre la classe correspondante a la table et voila son code : package stt; import stt.base.BaseBcn; public class Bcn ...

19. Delete an Entry of n from a 1:n    forum.hibernate.org

Hi, i ope you guys can help me out. if have a OneToMany-ManyToOne Association. The N-Elements are Stored in a List. My Problem now is, when i remove an Element of the List and save the Object with Persit, it doesn't remove the Entity in the Table. If i make a refresh on the first object i find the removed Element ...

20. Problem with delete    forum.hibernate.org

Exception in thread "AWT-EventQueue-0" org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [Elementare#12] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1014) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:165) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499) at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169) at org.hibernate.engine.Cascade.cascade(Cascade.java:130) at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131) at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at CancellazioneParti.cancellaButtonActionPerformed(CancellazioneParti.java:180) at ...

21. "Delete" (migration from hibernate2 to hibernate3 problem)    forum.hibernate.org

public void deleteModel(Integer modelCode) { getHibernateTemplate().delete( "from Model model where model.code = ?", modelCode, Hibernate.INTEGER); }

22. Delete one-to-many    forum.hibernate.org

...

23. Many-to-many delete    forum.hibernate.org

Hibernate version: 3.3.1 Database version: MySQL 5.1 I having been working on this bug for over two weeks and I can't seem to figure it out. Hopefully my little simplified example will be enough to explain my problem. I have a many-to-many relationship between my containers table and my widgets table (table names have been changed for this example). In the ...

24. Delete hibernate proxy on demand -Java-    forum.hibernate.org

Hi! I need your help. I need remove hibernate proxyes from an object to use it throw a WebService. I could do it using: Some_Object some_object = my_object.getSome_object(); if (some_object instanceof HibernateProxy) my_object2.setSome_object( (Some_Object) ( ((HibernateProxy) some_object).getHibernateLazyInitializer().getImplementation() ) ); But it isn't a general solution, because I must do it with every object embeded in some_object. Any solution? Thanks

25. One shot delete    forum.hibernate.org

This question has been asked many times, but I did not find a clear solution, so I'm asking this again here in the hope someone can help. The scenario is like this: I have a 'person' which can have zero, one or more 'products'. So I made a one-to-many set association from Person to Product. The association is uni-directional, from Person ...

26. Hibernate issues delete commands    forum.hibernate.org

Hello everyone, this is my first post on this forum. I'm actually facing a really strange behavior with my application, and I've lost the last two days in unsuccessful tries to come out from it. Here's a brief description of the model and algorithm: I've got several network hosts (routers), I query them via SNMP with a library which I wrote, ...

27. updatable = false except on delete?    forum.hibernate.org

Newbie Joined: Sun May 09, 2010 4:48 am Posts: 11 An author of a project isn't changed as long as the column/project exists (updatable = false), it looks like this: Code: class Project { ... @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", updatable = false) public ...

28. Delete troubles    forum.hibernate.org

Hi, I have a set of tables, and associations between these tables as seperate tables containing a uni-directional many-to-one. If i have table A and B, and an association table AB, then table AB contains references to A and B, but A and B does not know about the AB table. The references are mapped in AB as:

29. Delete doesn't work    forum.hibernate.org

Newbie Joined: Mon May 30, 2011 4:05 am Posts: 2 Hi, I am new with Hibernate and encountered an issue, I will describe it through a short example because the involved classes and tables are parts of a very complex project from where is a little difficult to take out the code. In the project Hibernate 3.3.1 is used. We have ...

30. AnnotatedClasses - Deletion Operation    forum.hibernate.org

Newbie Joined: Wed Aug 17, 2011 9:30 pm Posts: 2 Hie all, I'm quite new with Hibernate. I'm currently using Hibernate 3.4 and having a problem to perform deletion operation to a persistance object in my project implementing SPRING, Hibernate & Tiles togather. I have an object BlogEntry that has 2-manytoone relationship with object Company and BlogEntryStatus as below: Code: package ...

31. Many-to-Many delete...    forum.hibernate.org

I can't delete a relationship... My code is this... And... The method that delete the relationship is... beginSession(); proyecto = (Proyecto)session.load(Proyecto.class, idProyecto); categoria = categoriaBO.obtenerCategoria(idCategoria); Set sCategorias = proyecto.getCategorias(); sCategorias.remove(categoria); proyecto.setCategorias(sCategorias); session.update(categoria); session.flush(); But I have a error net.sf.hibernate.HibernateException: Another object was ...

32. Question on deletes...    forum.hibernate.org

2 quick questions. 1) session.delete( String, Object[], Type[] ); Does this take a regular sql statement with ?s. I can't seem to find a large amount of info on it in the documentation... If someone can point me in the right direction to find the docs for it, I would appreciate it. 2) I see a session.delete( Object ); Are there ...

33. Hibernate one to many 's delete    forum.hibernate.org

Newbie Joined: Sat Sep 13, 2003 12:47 pm Posts: 15 Code: ...

34. question about one-to-many delete    forum.hibernate.org

Newbie Joined: Thu Sep 11, 2003 2:07 am Posts: 4 There are one to many association between the following class: Code: ---------------------------------------------------------------------------

35. Deleting one-to-many    forum.hibernate.org

The table name is nom_query_parameter ... but it's not the problem ... My code and mapping works fine for adding / deleting parameters individually and also updating the query .. but when I try to delete the query I got an constraint violation because hibernate just send "delete from nom_query where id = ? " when it would to delete first ...

36. Delete doesn't work... Why? :(    forum.hibernate.org

Hi all, Today I have tried to use hibernate to update my persistence mechanism. Everything was going ok, implemented some basic methods to save/update and load objects in my PersistenceBroker and so on... However, when I tried to implement a method to remove an instance of a PERSISTENT object, nothing happened. I tried to use the code bellow with and without ...

37. Urgent! Delete on One-To-Many    forum.hibernate.org

Hi guys, I'm facing a problem while trying to delete a one-to-many records. Mapping as below ----------------------------------------------------------------------------------------- ---------------------------------------

38. .delete() question    forum.hibernate.org

Code: ... ...

39. "Fake" deletes    forum.hibernate.org

I've just started evaluating Hibernate for use with a legacy database, and have a situation where the DBA has used a somewhat unusual scheme: - Records are never actually deleted from a table - Instead, they have a "state" field that indicates if they are deleted From what I've read, I've seen no obvious way to model this using Hibernate. One ...

40. Deletion    forum.hibernate.org

41. problem with many-to-many delete    forum.hibernate.org

Hi, I'm probably missing something, but shouldn't many-to-many sets behave the same way as composite-element sets in delete situation? I have an entity which has many-to-many set without cascades (I don't want it to cascade over the link table). When I try to make session.delete("...") it fails, because link table foreign key constraints kick in. Only delete I'm seeing in the ...

42. delete without knowing the types of args    forum.hibernate.org

I would need something like Query.setParameter(int position, Object val) for a Session.delete, but I can't find any method that "guesses the Hibernate type from the class of the given object" for the delete(). So I took a look at the code, and turned out that AbstractQueryImpl uses a SessionImplementor class, which has a lot of useful methods (for example you can ...

43. HELP: Hibernate deletes my Set elements !!!!!    forum.hibernate.org

Please, any help on my problem would be really appreciated: When I add elements to a Set, Hibernate issues SQL deletes on flush, cause it thinks that I deleted previous elements. So on the DB we have only the last inserted element. Envinroment: Hibernate 2.1.2 JBoss 3.1.2 Oracle 9.1.2 I was able to reproduce the code with these few lines: Code: ...

44. cannot simple "delete from"    forum.hibernate.org

Following the topic on select and delete : [url]http://forum.hibernate.org/viewtopic.php?t=926955[/url] I understand that Hibernate has to do some Lifecycle staff, but then in a one to many relationship if I want to delete all the associated objects without deleting the owner, hibernate has to select all the objects and then delete one by one ! This is not a case of mass ...

45. many-to-many: undesired deletes    forum.hibernate.org

Sorry if this is a stupid question - I can't find the node in my head. I have a many-to-many association between two classes A and B. A sets inverse="false", B has inverse="true" and both have cascade="none". I have the methods A.getBs() and B.getAs() to get the associated collections from both sides. Now I'm working with an object A in different ...

46. many-to-one and delete    forum.hibernate.org

Hi guys, I have two classes and there is many-to-one relationship from class A to B. There isn't any relationship from B to A. The A class has getB method which return the B class. I would like to make that delete the B class should delete all A classes which refer to that B (session.delete(instanceOfClassB) ==> delete the instanceOfClassB AND ...

47. ConcurrentModificationException when deleting from a coll.    forum.hibernate.org

I've run into a seemingly simple problem relating to deletion of objects in a collection I'm iterating through. The setup is a very simple one-many, where the code below fails with a java.util.ConcurrentModificationException. Code: Iterator childIterator = getChildren().iterator(); while (iter.hasNext()) { ((Child) iter.next()).delete(session); } The getChildren method returns a set of children which ...

48. Delete elements    forum.hibernate.org

Hello, I have some problems when I try to delete an object using hibernate. I'm using the cascade=all in the parent object and this is the relation: The object I'm trying to delete is of the class trfg_TRAFGEN_DataModel.Traffic I use the delete method but, after that, I get an ...

49. Delete in many-to-many    forum.hibernate.org

User.hbm.xml Roles.hbm.xml The table Role_User_Link is created. The insert of it is also OK. But how to delete one relationship??? Here is my code: Code: UserDAO userDAO = new UserDAO(); User user = ...

50. delete problem    forum.hibernate.org

I'm trying to delete a parent with childs but can't do it... I have the cascade="all-delete-orphan"... the problem is when it try to delete one child it first set the parentID to null.. and then try to delete it... but i get a stale exception (i'm using version timestamp), i know why i'm getting the exception.. i just can't understand why ...

51. Is lightweight delete possible?    forum.hibernate.org

Is there a way to use hibernate to do a "quick delete"? The behavior I would like is to issue a delete query (and not have hibernate load up the object first, and then delete it), as well as have the option to rollback the deletes if something goes wrong. The problem is, if there are many objects, or the objects ...

52. Delete issues    forum.hibernate.org

I am trying to delete some of my objects , its doing everything fine except not deleting the objects. No exception at all. I could see the logs saying deleting it , any ideas. 2:53:35,969 DEBUG Cascades:46 - cascading to delete() 12:53:35,969 DEBUG SessionImpl:1453 - deleting a persistent instance 12:53:35,969 DEBUG SessionImpl:1487 - deleting [com.birch.vitria.blq.persistentobjects.ProductQualInfo#108546] 12:53:35,969 DEBUG Cascades:46 - cascading to ...

53. delete question    forum.hibernate.org

Let's say I have two classes, Resource and User and every resource has an owner (which is an instance of User). This can be easily done with a many-to-one association from Resource to User like this: Code:

54. deleting    forum.hibernate.org

Hibernate version:2.1.7c Name and version of the database you are using:mysql 4.* I have 2 way's of deleting objects one works fine but the other does not. my question should both way's work? first one that works fine: Set answers = user.getAnswers(); for (Iterator iter = answers.iterator(); iter.hasNext();) { DboAnswer answer = (DboAnswer) iter.next(); if(answer.getQuestion().getAva().equals(registrationNr.getAva())) { Service.delete(answer); } } second one ...

55. Data Deletion    forum.hibernate.org

56. Delete (Un)Successful?    forum.hibernate.org

Hi, I'm having similar question about session.delete method. I tried calling session.delete(object) and my delete statement was using primary key that does not exist in table (DB2). Hibernate throws HiberException. Is there a way to avoid this ? I want to see HibernateException for anything else but not for "row not found". In case of DB2, I'd like to see sqlcode=100 ...

57. Mass deleting...    forum.hibernate.org

58. SortedSet deleting elements    forum.hibernate.org

I have a problem that's just baffling me and I'm hoping it rings a bell with someone. I have a SortedSet of events, here's the .hbm snippet. I only ever add to the set, I never delete. The events are added when my finite state machine moves through states. The state machine is syncronized, there is ...

59. many-to many Delete issue    forum.hibernate.org

60. java.lang.StackOverflowError when deleting    forum.hibernate.org

Hello I get a java.lang.StackOverflowError when trying to delete a persistant object. Can it be due to some recoursive depdencies? here is my mapping file Code:

61. Using Hibernate When Deletions Should Not Delete    forum.hibernate.org

Design Question I am currently evaluating Hibernate to see how it can cope with legacy database designs. In some of my database tables rows shouldn't be deleted but should have an 'end timestamp' value set. This means that a new object may be saved but it already exists in the database and should actually be updated. I have a solution by ...

62. delete() doesn't do what I think it should do    forum.hibernate.org

Hi, This is kinda related to a couple of earlier posts involving attempts to migrate data from one database to another... According to the documentation, delete() on a persistent object should revert its state to Transient so it should be able to delete an object using a Session from SessionFactoryA (configured for database 1) then save it to another DB by ...

63. Question about deleting and PropertyValueException    forum.hibernate.org

public void delete(BusinessBean bean) throws DAOException { try { //new line added here bean = (BusinessBean)session.load(encapsulatedClass, bean.getId()); session.delete(bean); } ...

64. delete problem    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.2 How to delete an object with not-null="true" properties ? I have a uset table where the user name is not-null="true" I would like to delete the user without getting it from the db first. I try : UserBean userBean = new UserBean(); userBean.setId(new Long(1)); try { session.delete(userBean); session.flush(); ...

65. delete by rowid?    forum.hibernate.org

66. Best Deletion Method    forum.hibernate.org

Hi, I have a question. I want to delete a record from the table, and I want to avoid first retrieving by id and then deleting because it ends up being 2 sql calls. So, which of the following is most efficient: 1. Session.delete ( query ) where query = "Delete From Table where id = " 2. Or creating a ...

67. Hibernate not deleting, help    forum.hibernate.org

Transaction tx = null; try { tx = hibernateSession.beginTransaction(); logger.info("Deleting table CapacidadRequeridaBean"); hibernateSession.delete("from ...

68. delete return value behavior    forum.hibernate.org

The documentation for net.sf.hibernate.Session.delete() says that it will "Return the number of objects deleted." I am getting the following output: count = 0 count = 1 after running the following: s = sessionFactory.openSession(); //tx = s.beginTransaction(); System.out.println("count = " + count); count = s.delete(hql); System.out.println("count = " + count); //tx.commit(); By commenting out the transaction lines, this code had no chance ...

69. delete one-to-many    forum.hibernate.org

I have class Feature and Class CPProfile. they have many to many relationship. I use to one-to-many and CPProfile_Feature class since it has another column. When I try to delete the child (CPProfile_Feature ) the parent (Feature) is being deleted as well!! Why? I do: Feature f = session.load(....) f.deleteFeaturesFromProfiles(); Here are my classes: Class Feature{ Set featuresProfiles = new HashSet(); ...

70. one-to-many one shoot delete    forum.hibernate.org

Hi, I noticed that when I call clear on LookupTable.elemente hibernate make a delete for each LookupTableElement it found in the collection. Is this the corect behavior ? According to the reference guide [url]20.5.4[/url] I expected only one delete to be made. Hibernate version:3.0.5 Code: ...

71. delete one item from set    forum.hibernate.org

I have a relationship one-to-many. If I want to add a item to relationship, i add the item to the set and save the object, and hibernate makes it persistent. myObject.getRelacionEnlacesEncuesta().add(item); Session.save(myObject); When i want to remove a item from the relationship, i remove the item ...

72. Deprecated Delete    forum.hibernate.org

73. 3.0.5 and Delete    forum.hibernate.org

I am attempting to perform a delete via createQuery like this: createQuery( "delete WebLogEntry where website.id = :id") .setInteger("id", website.getId()) .executeUpdate(); However at runtme I am getting an exception: JDBC exception on Hibernate data access: could not execute update query; nested exception is java.sql.SQLException: Column not found: WEBLOG_ENTRY_ID in statement [delete from weblog_entry where weblogentr0_.weblog_entry_id=? and status=?] Looking at the sql ...

74. Delete question    forum.hibernate.org

I just started playing around with Hibernate and was running into problems trying to delete objects. My mapping file snippets & the code that does the delete is pasted below. Any help is really appreciated... QualifierType.hbm.xml public

75. delete best practice    forum.hibernate.org

I'm wondering what most people do when handling objects that are "deleted" by the front end, and not needed anymore. I put "deleted" in quotes because at previous jobs, we never really deleted rows, we just set the status != 1. How do you guys handle it? Lets say a user has a list of emails that they can add and ...

76. Delete problem    forum.hibernate.org

Hi, I am having a problem with delete. These are my mapping files Facility.hbm.xml

77. Problem Deleting from Set    forum.hibernate.org

I have studied up on deleting objects in "Hibernate In Action" and it seems simple enough. Yet, I am having a few issues. Basically, what it boils down to is that I will remove a RegistrationSession object from a set inside a Registration object but when it comes time to update the Registration object the deleted RegistrationSession object in the set ...

78. Delete being performed twice    forum.hibernate.org

Hello, I'm having a random problem while deleting an object. Once in a while, it seems that the delete is being executed twice by hibernate, the second one resulting in an exception (cf. trace). Have you ever seen such a behaviour ? Thank's for your help Jim Hibernate version:3.0.3 /*** / Ctlg catalog = DAOFactory.getCatalogDAO().getCtlg(cd, rav, secondLoc); if (catalog != null) ...

79. Permanent delete    forum.hibernate.org

80. delete the joiner in a many-to-many    forum.hibernate.org

I am sure there is a way to do this but I can't figure it out. I have a lot of cases where I have a many-to-many and I want to delete the joiner. So for instance I have three tables: USER (id , username, password) GROUP(Id, name) USER_GROUP_JOINER(user_id, group_id) A user has a whole bunch of groups attached to it: ...

81. Extraneous deletes    forum.hibernate.org

Author Message rwallace1 Post subject: Extraneous deletes Posted: Thu Oct 27, 2005 2:09 pm Newbie Joined: Fri Oct 14, 2005 2:35 pm Posts: 14 I'm trying to delete a persistent object that consists of a composite key and a set of objects. The delete works, but on careful inspection of the logs it seems that Hibernate is deleting the ...

82. one-to-many where the many can't be deleted; nullable fky    forum.hibernate.org

I have a number of situations in my model where I have a one-to-many and my business logic requires that I don't delete the many just detach it or made "obsolete". For instance I might have a product catalog which has categories and items. A category has many items. The user shops the catalog and attaches items to orders. The admin ...

83. delete problem    forum.hibernate.org

hi, A category contains several items (one-to-many) if I delete a item from the category (not cascade delete), it can be deleted from database for example: session.delete(item); the hibernate will generate a SQL as following delete XXX from .. but when I delete one item and update the category at the same time, hibernate alway generate two update SQL and set ...

84. Strategy for delete    forum.hibernate.org

85. Problem with delete in many-to-many    forum.hibernate.org

I have a many-to-many relationship between classes User and Role. Class Role is mapped as inverse="true". I don't want delete to cascade to the opposite entity, so if I delete a Role, I want to keep the associated Users. My problem is: If I delete a Role, I get a java.sql.SQLException: Integrity constraint violation because the entry in the many-to-many table ...

86. Hibernate behavior in case of double-delete    forum.hibernate.org

87. Automatic Deletion + Notification    forum.hibernate.org

Hi, Frist, in which way do you want to be notified? do you wanna receive an email or a message on you mobil :) ? You could implement a listerner which does listen to your "removeImage" Method or any other methodes where your image could be deleted. That actually depends on the model you use in your application. But that could ...

88. Logical delete - delete flag    forum.hibernate.org

Hi Right now I am working on a project and we are using hibernate. Our company policies don't allow doing a "hard delete" and we only use logical delete. Logical delete works like this. We have a flag on every table called is_deleted, then we map it to hibernate via yes_no type and what we are doing is the following: -When ...

89. many-to-many deletion on flush    forum.hibernate.org

During some test for optimization we encountered a particular behavior. We try to select in join fetch a map/list association (many-to-many) without catch the parent object but only the needed data. For sure it's not a best practice, and we do a different choice. Anyway we found that flushing the session and committing the transaction hibernate performs a delete from the ...

90. message deleted    forum.hibernate.org

91. Help in deletion    forum.hibernate.org

Hi, I tried many different types of coding combinations.I don't know what is the reason for all records deletion. This code has also produce the same result .(All record's deletion) private void createAndStoreEvent(int id) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); Event theEvent=session.get(Event.class,new Integer("0")); session.delete(theEvent); session.getTransaction().commit(); } The issue is by any other reasons?

92. many-to-one without one-to-many on other side.Delete problem    forum.hibernate.org

hari_sujathan wrote: Can I say in hbm2ddl that not to generate constraint for this many-to-on relation? I don't think so. Besides, you almost certainly don't want to do this. You shouldn't just delete something that other things have a reference to. Calin's suggestion is the usual solution, but alternatives are possible. For example, you could use a link table, and make ...

93. Delete problem    forum.hibernate.org

Basically, I have a one-to-many relationship between Parent and Children. The Parent has a map whose values are Child objects. The relationship is bidirectional, inverse=true, cascade=all-delete-orphan in Parent.hbm.xml and not-null=true in Child.hbm.xml. I am using Spring's HibernateTemplate. I am trying to re-assign all children from Parent p1 to Parent p2: [... get all children from p1 ..] child1.setParent(p2); child2.setParent(p2); [ .. ...

94. Delete problem    forum.hibernate.org

I have a class A having id,name and list of some integers which are ordered.Class A is mapped to Table A and the list of value type in this case integers are mapped to table B.When I want to delete class A the user passes id of some object of A, the row for this id should be deleted as well ...

95. FindByCriteria returns delete instance    forum.hibernate.org

I am evaluating the use of Hibernate and cannot work out how to do the following. My database is a single user database running locally on the users PC. I wish to interact with the user as follows: Start a transaction. Use performs change to a table (insert, updates, deleted) User then chooses to apply changes or cancel. To apply, the ...

96. PLEASE!!! I'dont make a delete register    forum.hibernate.org

Hy guys, Always returns e exception when i try exclude de register.... Ps.: follow the exception, class as configuration files. Thank's so much, =============================================== Exception in thread "main" org.hibernate.StaleStateException: Unexpected row count: 0 expected: 1 at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:27) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2291) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2440) at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:73) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at br.com.shc.database.dao.generic2.teste.TesteGenerericDAO.main(TesteGenerericDAO.java:111) ...

97. ObjectNotFoundException thrown after delete?!    forum.hibernate.org

Author Message tharrisx Post subject: ObjectNotFoundException thrown after delete?! Posted: Fri Jun 16, 2006 7:52 am Beginner Joined: Thu Oct 16, 2003 7:25 pm Posts: 38 Location: New York City When I attempt to delete an entity object using the code below, I receive an ObjectNotFoundException at the delete method call. The row in the DB is successfully deleted, ...

98. Delete doesnt work    forum.hibernate.org

Newbie Joined: Wed May 04, 2005 9:34 am Posts: 16 Location: Germany Hi, i have a one-to-many relationship between the two tables IbnKommune and IbnKennzahlen2004. My problem is that i cant delete a record of Kennzahlen2004. The mapping-files for the object IbnKommune is: Code: ...

99. Delete big amount of data    forum.hibernate.org

version 3.1 Mysql Hey, I need to delete big amount of data (around 300K records). I dont want that the delete process will disturb to the main process (event record) to run. I am going to delete the records with hql statement (is it good, is there any impcat that i need to consider) My questions: 1. Is there an option ...

100. Deleting problem    forum.hibernate.org

Hi friends, i have some problems about deleting records from database by hibernate. Here is the problem: when i delete records by hibernate everything is all right; the record is deleted from database but after deleting the record if i want to get all records, the record deleted before comes with other records( but this record isnt in the database) I ...