delete « Map « JPA Q&A





1. Not to delete child record on deleting parent table record    stackoverflow.com

I am little bit newbie in Hibernate and DBMS and stuck on a problem. I have two table. One is A and second is B. There is Many-to-One relationship between these ...

2. Hibernate's Delete Method giving StaleStateException    stackoverflow.com

I am trying to delete object using Hibernate's delete method but getting StaleStateException exception.My requirement is to delete an object based on the unique key so for this i am doing ...

3. want to delete child, but not childs references to other objects    stackoverflow.com

Let's say i have three objects: user, box, products the user has got a box, the box has references to different products that the user has got in his box. the user can basically ...

4. many-to-many: 'parent' is deleted when there is still another 'child'    stackoverflow.com

I have a many-to-many relationship where two records on one side have the same parent (the owner of the relationship) on the other side. When I delete one of the two ...

5. Hibernate Annotations one-to-many parent-child delete    stackoverflow.com

I am working with onetomany relationship in hibernate JPA annotations, here is my table and entity class details...

Service   (entity class: ServiceRegistration.java)
=======
serviceid
servicename

channel    meta table (entity class: Channels.java)
========
channelid
channelname

service_channel ...

6. Hibernate: Deleting child object    stackoverflow.com

I have the following POJO class:

@Entity
@Table(name = "category")
public final class Category extends AbstractData<Category>
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer categoryID;

   ...

7. facing problem while deleting a child record in hibernate.    coderanch.com

I am trying to update a child records i have following scenario master record (having one to many assciation with child table cascade=all in .hbm.xml configuration file) ===> customerInfo detail record set (having many to one assciation with master table cascade=all in .hbm.xml configuration file) ===> customerAccountsSet i do following steps to update a record 1) get the customerInfo objetc from ...

8. Hibernate - Deleting a parent and it's children    coderanch.com

Hi there! I need some help understanding something/getting it to work. In a previous post (http://www.coderanch.com/t/217070/ORM/java/Hibernate-one-many), I was having a hard time understanding how to get one-to-many collections to work. Thanks to your help, I managed to figure it out. Now, I'm trying to figure out how to delete the collections (and then the parent). Now. What I fiugure, is when ...





11. Hibernate | Many to many mapping | problem in add and delete    coderanch.com

1. When I add data, data should be added in account table and account_product table but my product table should be untoched, it should work like a lookup table. 2. When I update data, data should be updated in account table and its association table - account_product. For example if product 2,3 are already assoiated with account and now I want ...

12. cannot delete object(parent with children)    forum.hibernate.org

13. delete child from one-to-many: best practice    forum.hibernate.org

hello, I'm new to Hibernate, and I'm facing one problem here.... I have one-to-many mapping, and I want to delete from child table. this are the steps: 1. I load the parent data into forms (collection of textfields), and the child data into an arraylist 2. I delete one of the arraylist item 3. I save the parent data and the ...

14. Delete children    forum.hibernate.org

Suppose a CRUD application in JSF. The user edits the Student and clicks on "Delete attach" button. Then, the action do: student.setAttach(null). After, the user clicks on the "Save record" button. Now, how can I know what attach was referenced? I will need keep the reference. The Attach is a weak entity. So, I would not like to implement a Attach ...

15. deleting child entity    forum.hibernate.org

Ok I check with version 3.5.5 and it does NOT work. But Why does JIRA says this feature has been corrected ? http://opensource.atlassian.com/project ... e/HHH-4726 I tried with the following XML mapping : person

16. Unable to delete a map of entities    forum.hibernate.org

Hi! I've found that it is unable to delete a map of entities. This code is just an example. My goal - is to get a clear database before tests run so I'am sorting the table mappings in the dependency order and clearing it one-by-one. I've found that having following class-mappings structure doesn't allow my to clear the db. Or there ...





17. Child records are deleting automatically after redeploying    forum.hibernate.org

Hi Friends please help me. I am getting strange issue. cityBean is parent class and RvBoardingPointM is child table. one-to-many mapping between cityBean and RvBoardingPointM . Following code is for saving parent and child records. RvCityM cityBean = new RvCityM(); cityBean.setName("Testing"); cityBean.setCreatedDate(new Date()); cityBean.setStatus('A'); Set points = new HashSet(); RvBoardingPointM point1 = new RvBoardingPointM(); point1.setName("Test1"); point1.setRvCityM(cityBean); RvBoardingPointM point2 = new RvBoardingPointM(); ...

18. hibernate does not delete the child entity    forum.hibernate.org

hibernate does is delete the association in the join table but it does not delete the child entity. My Entity Mapping public class Role { @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY) @JoinColumn(name = "role_id") @org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN) private List userAuthoritiesList; } public class UserAuthorities { @Id @SequenceGenerator(name = SEQUENCE, sequenceName = "xx_id_seq") @GeneratedValue(strategy = GenerationType.AUTO, generator = SEQUENCE) @Column(name ...

19. delete parent/child problem    forum.hibernate.org

Hi I've got a problem with deleting parent/child record from database, the problem is that hibernate generates delete for parent before deleting his child and database complains Code: ERROR: update or delete on table "customer" violates foreign key constraint "customer_id_fk" on table "orders" Detail: Key (cus_id)=(1) is still referenced from table "orders". ...

20. can not delete the entity which have collection as child    forum.hibernate.org

Beginner Joined: Fri Nov 05, 2010 7:25 am Posts: 21 hi: IN my application,I have some entities which own some collections,when I have no idea to delete them. This is the core codes of my eneity: Code: @Entity @Table( name = "t_task") public class Task { private int ...

21. many-to-many: parent deleted when there is a child    forum.hibernate.org

Newbie Joined: Fri Aug 05, 2011 1:36 am Posts: 1 Hello everyone, I have a many-to-many relationship where two records on one side have the same parent (the owner of the relationship) on the other side. When I delete one of the two records the parent and jointable records are also deleted. I don't want this. I expect that the parent ...

22. Hibernate | Many to many mapping | problem in add and delete    forum.hibernate.org

1. When I add data, data should be added in account table and account_product table but my product table should be untoched, it should work like a lookup table. 2. When I update data, data should be updated in account table and its association table - account_product. For example if product 2,3 are already assoiated with account and now I want ...

23. how to delete child    forum.hibernate.org

24. Parent-Children Delete Problem    forum.hibernate.org

25. Deleting child    forum.hibernate.org

Hi I have a group which contains a set of groupReports. When I do a session.delete(group), Id like all its child to be delete as well but it seems to send an update on the child table instead of a delete. Here is my mapping --------------Parent PTBN_SEQ_G ...

26. can't get one-many mapping working with one-shot delete.    forum.hibernate.org

Hi, I am trying to get a simple one-many mapping working in the following use-case. ---- Find Team/Players - Open Session - Find Team (loading the players collection (bag) ) - Close Session. ---- Update Team/Players in a later session - Open Session - Remove all children (players). I dont maintain the ids for the existing children and want to do ...

27. ObjectNotFoundException when delete child in many-to-one    forum.hibernate.org

Hello, I have a parent-child relationship between ResultSet and KPI. But don't want to cascade a deletion of a ResultSet to the child KPIs, so this property is not set in the mapping. I get an ObjectNotFoundException when the following occurs: *delete ResultSet "TestRs" with ID = 101 *had existing KPI which had reference to "TestRs"; i.e. the ResultSetId column in ...

28. Problems with automatic Child-Collection deletion    forum.hibernate.org

Hello everybody! I use the following combination of Objects in Hibernate: Order having a Collection () of OrderParameter objects mapped to it. Now what I would like to do is to be able to delete an Order-object. Consequently removing all OrderParameters that it has among it. To do that I added a "cascade=delete" to the respective collection mapping. Now what Hibernate ...

29. many-to-many mappings deleted on evict    forum.hibernate.org

public Service findServiceByKey(String key) { Service service = null; try { Session session = getSession(); // retrieve a session maintained by ThreadLocal Service service = (Service) session.load(Service.class, key); // load the service session.evict(service); // evict it from the session - this causes the associations to ...

30. Delete child in an existing collection    forum.hibernate.org

I have an object with a collection. i create the parent object and 2 childs, i save : ok. i delete 2 object from the set and create a new one, save it and add to the set. i save the collection : i have in database 3 childs (2 with null as parent id and one with the correct parent ...

31. How to Delete all child objects    forum.hibernate.org

Login Register FAQ Search View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] How to Delete all child objects Page 1 of 1 [ 1 post ] Previous topic ...

32. How to delete a parent without delete yours childs?    forum.hibernate.org

Hi all, sorry my bad english... I need to delete a parent, but keep yours childs. My problems is: I have an group, such as "programers'" and yours users "john", "mary" and "george". I need to delete the "programers" group, but preserve the users "john", "mary" and "george" (because these users are used in other groups). The relation between groups an ...

33. Deleting a child    forum.hibernate.org

I'm using hibernate 2.1, MySql 2.0.12-nt, j2sdk1.4.2_04 My app has a class - Relatorio - that is composed of two classes: Turma and Disciplina. Turma has a child - Detalhe. Here are my mapping docs: Relatorio: Code:

34. Deleting just a single child    forum.hibernate.org

My goal: to delete a child. so i came up with this code: Code: //... for (int i = 0; i < lista.size(); i++) { Detalhe detalhe = (Detalhe) lista.get(i); ...

36. How do I perform this delete with this many-to-many mapping?    forum.hibernate.org

Newbie Joined: Wed Jun 16, 2004 11:20 am Posts: 6 I have class A which contains a list of objects of type class B Class B can know nothing about class A. With my mappings (below), everything works great when I add a b object to A's list. But the problem is B objects can get deleted while still in A's ...

37. Parent/Child - Delete Node But don't include descendants    forum.hibernate.org

Hi, Is it possible to remove a node from a hierarchy of entities (parent/child relation) without remove its descendants node?. If he decides to include descendants (so remove the whole branch), cascade="all-delete-orphan" is perfect (my mappings are OK, no reason to post them here) A->B->C If B is removed [A.removeChild( B );], cascading removes C However, if the user deletes a ...

38. Unable to delete a child    forum.hibernate.org

Hibernate version: 2.4 Mapping documents:

39. Looking for a "ON CHILD DELETE RESTRICT" behaviour    forum.hibernate.org

Hi, I have a -maybe not so 'pure' relational- database requirement on a certain table. That table contains records referred to (FK) by many other tables. When it is being referred to, I want to restrict the deletion of a record in that table. This is sometime called a "ON CHILD DELETE RESTRICT" constraint. I read the 'Bauer' book (several times) ...

40. How to delete parent when child is deleted?    forum.hibernate.org

Hibernate version: 2.1.6 In Hibernate one can have cascading operations *from parent to children* (some entity manages its lists, sets, maps or other child entites). We have a mapping file "Schedule.hbm.xml" where every Schedule is bound to House, Flat and so on: ... ... In this relation the parent is Schedule and children are House, ...

41. Parent/child relationship: same table = problems deleting    forum.hibernate.org

Hi! I have a parent/child relationship in the same table. When an item is deleted, I want all its children to be deleted, too. If I delete an item with no children, all works fine, but when the item has one subitem or more, it complains with this exception: ERROR: update or delete on "cm_category" violates foreign key constraint "fka01e3933afbcd1cf" on ...

42. cannot delete child in one-to-one.    forum.hibernate.org

Hibernate version: 2.1.7 Mapping documents: hibernate_sequence hibernate_sequence Code ...

43. Deleting all same class children from the root    forum.hibernate.org

I start to think that it's not possible at all, but I need to ask for it. Imagine a website like DMOZ with a lot of categories each category is an instance of Category class persisted by Hibernate. Mapping for children could looks like: .... ...

44. Child is not deleting    forum.hibernate.org

Beginner Joined: Thu Jul 29, 2004 7:14 pm Posts: 41 Hibernate version: 2.17 Name and version of the database you are using: MS SQL Server 2000 I have 3 tables: CD_JOB_PAAK, SCH_TASK_PAAM and SCH_TASK_JOB_PAAD. The CD_JOB_PAAK table contains jobs and SCH_TASK_PAAM table contains tasks defined in the system while the SCH_TASK_JOB_PAAD table is the link table. /* Setup Tables */ CREATE ...

45. Child delete    forum.hibernate.org

Hi, I am having a Hibernate For Dummies problem with a parent -> child relationship deleting the children when I delete the parent. My understanding is that if I specify cascade="all-delete-orphan" that dereferenced children will be deleted. But, I assume that if I delete the parent entity via a call to session.delete(parent) that SQL deletes would be generated for ALL the ...

46. Newbie Question about Deleting Parent and Children    forum.hibernate.org

Hi all, I have a newbie question, I have search in this newgroup and in the web for some answer and I haven't fould any. I have found many question of this type, but with no answer. By the way I am using Hibernate 3.0 with Spring 1.2RC1. My question is very simple and probably trivial. I have this POJO structure: ...

47. Delete child object from db when dereferenced from parent    forum.hibernate.org

Hi Thans for this great product on the first place! I have a question here, I have not found answer in the forum yet. :) I have the following problem. Datarecord is the parent Customer is the child I mapped them the following way attributes...... Everything works fine thanks to the ...

48. one-to-one mapping - How to delete?    forum.hibernate.org

49. Mixed up with delete child from one-to-many    forum.hibernate.org

...

50. Can't use on-delete for key in a collection map?    forum.hibernate.org

51. Deleting children - best practice?    forum.hibernate.org

[I'd worry about this title if it were on any other forum...] Let's say I have a Parent object, with a Collection of Children. The cascade is marked as 'all-delete-orphan'. When the parent object is saved, all changes to the children collection are made, too. This is done in a single 'storeParent' service method which is wrapped in a transaction, courtesy ...

52. Delete - Many-to-one Mapping    forum.hibernate.org

I am new to Hibernate. In my application a class "Analysis" have unidirrectional many-to-one association with a class called "Dataset". In the "Analysis" mapping file the relationship specified as follows: When I delete Dataset object using Session.delete() I am getting an exception, org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch updae. Is there any setting available in ...

53. How to keep Parent when deleting child in many-to-one    forum.hibernate.org

Newbie Joined: Mon Feb 07, 2005 8:48 pm Posts: 6 Im having problem deleting objects. I think there is a problem with my understanding of mapping object in this situation. The idea is such : Movie has an attribute Author -> So I have this code there : /** * * @hibernate.many-to-one column="author" cascade="none" not-null="false" * update="true" insert="true" */ public Contact ...

54. Parent delete child: really stuck here    forum.hibernate.org

public boolean equals(Object obj) { if (null == obj) return false; if (!(obj instanceof epaper.server.model.PoolClient)) return false; else { ...

55. Delete "where exists" for child table    forum.hibernate.org

DELETE FROM Child WHERE EXISTS (SELECT 1 FROM Parent WHERE Parent.field1 = 642 AND Parent.field2 = 1 AND Parent.pkid ...

56. set of childred doesn't get modified when child is deleted    forum.hibernate.org

a class has a method getChildren() now I just want to delete one child using session.delete(aChild). if I invoke getChildren() it still contains the child I deleted. Is it possible to make the deletion of the child update the set that is returned from getChildren() or is it just not how it is supposed to be done? I come to think ...

57. Delete Parent and Child Records    forum.hibernate.org

Hi Everyone, I have two tables with parent and child relationships. I need to delete two records from both tables at one shot. I created a collection in which i have parent object and this parent object again contain child object And I passed this collection to deleteAll method. Hibernatetemple().deleteAll(collection) I have my mapping file like this Parent hbm file:

58. Deleting childs automatically    forum.hibernate.org

Hello friends, I've a question about a parent/child relation. I've a parent and I've mapped the childs with a Set and with the property cascade="all", then I suppose that when I delete the parent then the childs must be deleted automatically because the cascade="all" property, don't they ? My problem is that if I create a foreign key in the child ...

59. Deleting assignments in Many-to-Many mappings    forum.hibernate.org

I have the following database structure: Metadata 1--* Metadata_File_Asgt *--1 File Nice and simple. Now, when I want to delete a Metadata record, I want the delete to be cascade to the Metadata_File_Asgt, but NOT to the File (even if the file is orphaned, I still want to keep the record). However, when I use the following mappings, I get a ...

60. Parent entity marked dirty on deleting child entities    forum.hibernate.org

Hi, We are using hibernate interceptor (hibernate 2.0 event model) to capture audit data. We often navigate through a parent entity say "Person" even for a use case to delete person akas (PersonAkas). Person has a one to many relationship to PersonAkas, so to delete a person Aka, we have a business method inside Person: public void removePersonAka(personAka) throws BusinessRuleException { ...

61. children objects do not get deleted in Database    forum.hibernate.org

We have the following problem: our child objects do not get removed from the database. Using Hibernate we persist objects of a class called "Aanvraag", this class contains a list of other objects of the type "BijzondereBepaling". When we remove "BijzondereBepaling" objects from this list they do not get deleted in our database (Sybase). If we add elements to the list ...

62. One-toZeroOrOne maping breaks on child delete    forum.hibernate.org

----------------- ---------------- | Component | |Block | ----------------- 1 0..1 ---------------- | id | <----------------> | id | ----------------- ---------------- | attributes | | attributes | ----------------- ---------------- Component Block Component aComponent = new Component() //Brand new component Component represents a tree of components //Set some blocks for some children Works OK ...

63. org.hibernate.ObjectDeletedException When deleting child obj    forum.hibernate.org

Full stack trace of any exception that occurs: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.transaxiom.axslogistics.fincalculation.dto.DecisionLineChargeDTO#1442] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:742) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:166) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468) at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154) at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771) at org.hibernate.engine.Cascades.cascade(Cascades.java:720) at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895) at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792) at org.hibernate.engine.Cascades.cascade(Cascades.java:720) at org.hibernate.engine.Cascades.cascade(Cascades.java:847) at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:121) at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:112) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:59) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)

64. Parent / child relationship: deleting the parent    forum.hibernate.org

Hi, I am working with Hibernate 3.1.1 on PostgreSQL 8.1.0 and I have a very basic problem with a parent/child relationship and deletes. I have a Parent object called Layout, with a simple one-to-one relationship to a child object called Cell. What I want, is that when I delete the parent object, Layout, the child object Cell is deleted too. I ...

65. Hibernate --> Child deleting problems    forum.hibernate.org

Hi, I have following script in parent hbm file for child as: the problem is when i update the child with parent or insert more childrens so there is no problem. but when i update the parent with child. if child insertable or updatable so it perform that tasks. and ...

66. Problem in child delete    forum.hibernate.org

67. Deleting assignments in Many-to-Many mappings    forum.hibernate.org

As the subject suggests I have problem with deleting the records in many to many relationship. I have referred the link in forum and is quiet helpful http://forum.hibernate.org/viewtopic.ph ... manytomany I have a many to many relationship between the Employee and Project. As per the link mentioned above everthing works fine when I delete Employee where i have mentioned cascade="save-update". and ...

68. Deleting child object from parent    forum.hibernate.org

Hibernate version:3.0 I have two classes, parent and child, where one parent can have a set of children. Now, I would like to delete a child. Is there some way for me to delete this child, just using session.delete(child), without also having to remove the child object from the set of children stored in the parent object? like: public void delete(Child ...

69. Trouble initiating auto delete on one-to-one mapped child    forum.hibernate.org

I am trying to delete a property from my parent object which has a one-to-one relationship to the property, but unfortunately, hibernate doesn't let me set cascade="all-delete-orphan" for a one-to-one mapped property. The save of a new property and update of an existing property is working great, however, the behaviour that I'm looking for and missing is that I want the ...

70. How to delete a mapping class from Configuration    forum.hibernate.org

I want runtime change a mapping class. I have read lots of topics, rebuild SessionFactory is a reasonable way. However, it is too long to rebuild all mapping classes. My idea is just replace the changed class (Only one or two). There are lots of add mapping class methods in Configuration, but how to delete one existed class? I found all ...

71. Novice having problems with map and entity deletion    forum.hibernate.org

Hi, maybe this is easily solved but I can't find any information: I am progamming a website with categories. Each category shall have a map/list of related categories. So I wrote a class category with Map relatedCategories and provided the following mapping: Mapping document:

72. No delete triggered by Map.clear()    forum.hibernate.org

I got a persistent, attached map (cascade: all, delete-orphan) on an entity. When I clear() this map and fill in new objects with the same key I get unique constraints violations on the map key when committing, because hibernate does NOT issue any sql deletes. When I manually do a Session.flush() after the Map.clear() (what I want to avoid), hibernate generates ...

73. Can this children-parent deletion be done automatically?    forum.hibernate.org

Here is a common use scenario of messaging: A message must have at least one recipient. A message shall be deleted after the last one recipient of the message is removed. Is possible that can be done automatically thorough Hibernate configuration/mapping? Hibernate version: 3.2 Mapping documents: Code: ...

74. Unable to delete child from collection    forum.hibernate.org

...

75. deleting a one-to-one child object    forum.hibernate.org

Hi! I have this little problem and it seems to me there are no posts in the forum about that. I have a parent object A and a child object B mapped in two different database tables; in A's hibernate mapping I write: When I add B in A (calling a method like instanceOfA.setB(new B()), for ...

76. Cascasde Delete Does not work when using Maps    forum.hibernate.org

Hello, I have a object called user that has child objects called UserAttributes which are returned as a Map. When, I try to delete a user, I get the exception below. I would like to delete the attributes with the user. Any thoughts on how I can resolve this? Hibernate version:3.2 Mapping documents:

77. Cascasde Delete Fails when using Map Collections    forum.hibernate.org

Author Message suneetshah Post subject: Cascasde Delete Fails when using Map Collections Posted: Thu Jun 21, 2007 11:02 pm Beginner Joined: Mon May 07, 2007 11:12 pm Posts: 20 Hello, I have a parent - child relationship where I am return the collection of child objects in a MAP. However, when I try to delete the parent object with ...

78. delete child when deleting parent    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.2 Mapping documents: Code between sessionFactory.openSession() ...

79. breaking parent-child by deleting a child    forum.hibernate.org

Hi there, Given the following relationship: public class A { private Set tags; // a set of Tag ... } public class Tag {... } and the mapping: By default, if some Tag is contained in some A.tags, that Tag can't be deleted because of ...

80. Deleting a child in a one-to-one relationship    forum.hibernate.org

I have two entities that have a one-to-one relationship as follows: Code: public class ParentTable { private long id; ... @OneToOne(mappedBy="Parent",cascade=CascadeType.ALL) @JoinColumn(name="id") public ChildTable getChildTable() { return childTable; } ...

82. Deleting Child object    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.2.5 Name and version of the database you are using:Oracle9i Mapping file: cbs_ind_bill_q1 ...

83. problem deleting child categories if parent category deleted    forum.hibernate.org

problem deleting child categories when parent category is deleted i had a Category pojo public class Category { protected List childCategories; /** * @return the childCategories * @hibernate.list name="child_categories" * @hibernate.key column="parent_id" * @hibernate.one-to-many class="com.xxx.apps.xxx.model.Category" cascade="all-delete-orphan" * @hibernate.list-index column="display_order" */ public List getChildCategories() { return this.childCategories; } } when i delete the parent all the childs should also be deleted. childs ...

85. Check for referring children when deleting an entity    forum.hibernate.org

Hibernate version: 3.2.6.ga Hi, in many part of my application I need to check if an entity has referring children without cascade delete before remove it, but doing all these check manually require a lot of code (also because not all parent-child association are mapped on both associations ends), so I was looking for a way to do these checks automatically ...

86. Deleting Parent and Children--muliple queries executed    forum.hibernate.org

Hibernate version: 3.2.2 Name and version of the database you are using:Oracle 10G I have searched through the forum but could not find a solution to my problem I have a Parent and multiple associated collections to it as shown below Parent ---childx1 ---childx2 ---childy1 ---childy2 ---childz1 ---childz2 For all the childs I have lazy=true Also in the parent hbm file ...

87. Unable to delete child when parent is deleted    forum.hibernate.org

Hi, i m a newbie....so forgive me for any mistakes i have a bidirectional relationship here is the code for my parent entity with child set here is the code for child enttity however when i try to ...

88. THE way to delete child objects using JPA + Hibernate    forum.hibernate.org

Hi I've been fighting with how to delete child objects in a OneToMany all day. At first I didnt realise that JPA does not (yet) support delete-orphan, so although the link between my parent and child(ren) was being severed, the child was still in the Database. Then I ran into all sorts of concurrent modification issues because I was using my ...

89. Deleting child records using hiberate    forum.hibernate.org

In the application the relationship is one to many.I am using DB2. When i am inserting from application both parent and child records are creating. But when i am deleting it is throwing following exception. [2/12/09 21:34:34:442 IST] 3021d4b5 SystemOut O Hibernate: update RNT_CHG_VND set RNT_CHG_HST_ID=null where RNT_CHG_HST_ID=? [2/12/09 21:34:34:442 IST] 3021d4b5 SystemOut O Hibernate: update INT_CMP_RNT set RNT_CHG_HST_ID=null where RNT_CHG_HST_ID=? ...

90. Simple one-to-many mapping for deletion    forum.hibernate.org

Hi, We have 2 entities. ITEM and VARIABLE. An Item can have more than one-variable. The variables will be updated, which means, every time an item.setVariables(List) is invoked and session.saveOrUpdate(item) is done, the old variables should be removed and the new ones be inserted. The configuration we have works for Inserts, but it fails to delete the existing Variables. We have ...

91. Many-To-Many Deleting child does not delete LU_table    forum.hibernate.org

I have a many-to-many association that is bi-directional between an Area class and an Item class. An area contains many Items and an item can be associated with many areas. Using annotations, I have: Code: @Entity @Table(name = "item") public class Item { private List areas; @OneToMany(mappedBy = "items") ...

92. Child entities not deleted when calling clear on the collect    forum.hibernate.org

Thanks a lot. That solved it. I have a question though. For my understanding, why is it working without DELETE_ORPHAN when entities in a collection have a simple Id attribute (e.g. private Long Id;). Indeed, my problem above only occurs when entities in the collection have a composite key. Thanks again for your help.

93. One-to-one mapping deletion of mapped entity    forum.hibernate.org

Hi community, in my project I have a entity of type A mapped to another entity of type B. I just want to verify if it is possible to delete the mapped object B by setting the reference the reference to it in entity A to null? At the moment I have to set the reference to null and delete entity ...