remove « Map « JPA Q&A





1. How to remove entity with ManyToMany relationship in JPA (and corresponding join table rows)?    stackoverflow.com

Let's say I have two entities Group and User. Evety user can vbe member of many groups and every group can have many users.

@Entity
public class User {
    @ManyToMany
 ...

2. Hibernate cannot remove child from database    stackoverflow.com

Here is my situation: I load an object that contains a bi-directional parent child relationship into my database. Later, that object is loaded into my UI where changes can be made, ...

3. Hibernate: How to remove an entity to which none refers to anymore in ManyToOne?    stackoverflow.com

I have two entities, lets call them A and B, which have a ManyToOne mapping to another entity, say C So I typically have something like this: a1->c a2->c b1->c Lots of A's and B's pointing ...

4. Best practice when removing entity regarding mappedBy collections?    stackoverflow.com

I'm still kind of undecided which is the best practice to handle em.remove(entity) with this entity being in several collections mapped using mappedBy in JPA. Consider an entity like a Property that ...

5. Removing parent and all children    stackoverflow.com

I have a problem removing the parent entity from the database. The code looks like this:

public class Parent implements Serializable {
  @Id
  @GeneratedValue(strategy = GenerationType.TABLE)
  private Long id; ...

6. NHibernate: Removing child from many-to-many relationship causes exception    stackoverflow.com

I've been battling with this issue for a couple of days now. I have a couple of classes in a many-to-many relationship, configured like so:

<class name="Entry" table="Entries">
    <id name="Id" ...

7. JPA: When parent entity got removed, child entity still remain    stackoverflow.com

Customer Entity (Parent Entity)

@Entity
public class Customer {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

private String name;

@OneToMany(mappedBy="customer", cascade=CascadeType.ALL)
private List<Facility> facilities;

//Setter and Getter for name and facilities

public void addFacility(Facility facility){
    if(this.facilities == null){
 ...

8. how to remove one-to-many child from parent given the child id in HQL    stackoverflow.com

I've got

class Parent
{
    IList<Child> Children;
}

class Child
{
}
When deleting a Child I need to remove all references to it from any Parents that reference it. How can I do this in ...

9. ManyToMany remove problem    stackoverflow.com

I have a table: DocumentType:

 @ManyToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST}, fetch = FetchType.LAZY)
 @JoinTable(
   name = "document_type_property_type",
   joinColumns = @JoinColumn(name = "document_type"),
   inverseJoinColumns = @JoinColumn(name ...





10. Hibernate query:Don't delete child when removing association with parent    stackoverflow.com

I am removing a Child from its association(many to one) to Parent.When i use saveOrUpdate method on Parent, Hibernate by default tries to remove Child from the Table.Is it a bug ...

11. hibernate doesn't remove child with named query, but removes with session.delete()    stackoverflow.com

I am not an expert with hibernate, as stated in the subject, I have an Object with a Collection of object in it. I tried to use a

session.delete(myObject) 
and the entity ...

12. How to write Hibernate HQL query which remove all "grand children" elements?    stackoverflow.com

I have schools, which contains groups, which contains students. I would like to remove all students from specific school. In SQL I can write the following query:

DELETE FROM students1 
WHERE students1.group_id IN 
 ...

13. JPA relationship not getting updated when children are removed    stackoverflow.com

Given the following scenario:

@Entity
public class A {
  @OneToMany(mappedBy = "a", cascade = CascadeType.ALL)
  private List<B> bList;
}

@Entity
public class B {
  @ManyToOne()
  @JoinColumn(name = "a_id", referencedColumnName = "id")
  ...

14. How to remove a many-to-many association in Hibernate without actually deleting Objects    stackoverflow.com

I have 2 Hibernate classes in a Spring-driven Application like these:

@Entity
public class Image {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;

@ManyToMany(mappedBy = "picture", fetch = FetchType.LAZY)
private Set<InspectionObjectDetail> inspectionObjectDetails = new HashSet<InspectionObjectDetail>();

@Override
public int hashCode() {
 ...

16. Save/remove children through parrent collection    forum.hibernate.org

Hi, i am writing a piece of logic which would save/remove attachments to an action. Frontend displays all possible attachments for this action and then the user has to select which attachment to save with that action. Selected attachments are saved in a different entity. Upper layer provides me with a map of attachments (Map -> second parameter mean attachment ...





17. Removing Child object from DB    forum.hibernate.org

I've just ran into a problem (well for me anyway). I have a class called Department which has a collection of TradingAccounts(). This all persists OK in the database. My problem occurs when I delete one of the items from this collection. Although my Collection of TradingAccounts no longer has a reference to it, it remains in the database!. I've read ...

18. Remove mapped class from the configuration.    forum.hibernate.org

I am writing for my diploma thesis an aspect oriented persistence layer. I use Hibernate for the persistence layer and add aspects to it. My goal is that the programmer only need to declare a java object as persistent. Other things such as mapping and database access code will be automaticaly added from the aspects. The problem I have now is ...

20. removing value from Map collection doesn't update database    forum.hibernate.org

Hibernate version: 2.1.7 Mapping documents: ... Code between sessionFactory.openSession() and session.close(): session.beginTransaction(); ... Folder folder = session.get(...); ... folder.getAttributes().remove("abc"); transaction.save(folder); transaction.commit(); This snip is from a webapplication we're writing where for each http request a session ...

21. update instead of delete when removing a child from parent    forum.hibernate.org

Beginner Joined: Thu Jun 17, 2004 10:08 am Posts: 21 Location: Paris-France Hi, Before all, thanks for you attention :)) ! I'm using hibernate2.1 with Oracle9 and my program is a stand alone application. My problem: So, i have 2 objects: TransoraDetail and TransoraAddModifyDetail; The relationschip betwen the 2 objects it's one to multi (unidirectionel); a TransoraDetail can have one or ...

22. Update parent in one-to-many doesn't delete removed children    forum.hibernate.org

I am having trouble with a parent-child relationship. Specifically dealing with children not being deleted from the DB when they are removed from the parent's collection. The mappings shown below work when I delete the parent (ie. the children are deleted from the DB as well), but on an update, the removed child is never deleted from the DB. Hibernate version: ...

23. hibernate stucks after adding/removing a mapping property    forum.hibernate.org

Author Message MistaMoasn Post subject: hibernate stucks after adding/removing a mapping property Posted: Tue Jun 28, 2005 9:22 am Beginner Joined: Mon Jun 06, 2005 4:23 am Posts: 41 Location: Hagenberg, AUSTRIA regarding to my hibernate tools post http://forum.hibernate.org/viewtopic.php?t=944348 i got the same problem without using the hibernate tools. hibernate stucks during execution of my application code, too. steps ...

24. Problem removing child object from collection after saving    forum.hibernate.org

Hi, I'm having problems removing a child object from a collection immediately right after saving it. The use case that fails for me is as follows: 1. I load the parent with all the existing children. 2. I add a new child. 3. I call saveOrUpdate. 4. New child appears on the database and is given a generated primary key. 5. ...

25. Replicate not removing children    forum.hibernate.org

Newbie Joined: Mon Oct 10, 2005 8:33 pm Posts: 2 I poked around a bit, but couldn't find an answer to the question I have. I have an entity that involves a one-to-many relationship - an order is the parent, and an order can be served by multiple shipments. This entity is stored in two separate databases. One database is the ...

26. One to one mapping and remove...    forum.hibernate.org

27. Child object is not deleted when removed from collection    forum.hibernate.org

Author Message patrick.wilkes Post subject: Child object is not deleted when removed from collection Posted: Wed Jan 18, 2006 8:02 pm Newbie Joined: Wed Jan 18, 2006 7:30 pm Posts: 4 I have a problem working with detached objects, in that in certain circumstances child objects (in collections) that should be removed are not being removed when the detached ...

28. Removing and Updating Childs in HashSet    forum.hibernate.org

Author Message Sukumesh Post subject: Removing and Updating Childs in HashSet Posted: Tue Mar 14, 2006 3:32 am Newbie Joined: Tue Mar 14, 2006 2:36 am Posts: 1 HI all, I am getting Constraint Violations while doing this. 1. I am retriving Master Object from DB 2. Removing Childs from the Master Object 3. Adding New child objects To ...

29. children not removed from db when removed from collection    forum.hibernate.org

Beginner Joined: Fri Oct 27, 2006 3:35 pm Posts: 21 Hi Folks, I'll apologise now if this question has an obvious answer, but I've been stumped for days now even after trawling this forum and other online examples... I've got a fairly typical 'user' / 'basket' / 'basket item' arrangement for an online shop. Each User has exactly 1 Basket, and ...

30. Change the parent of an child entity without remove    forum.hibernate.org

Hi, I have a 1:N association. For example a customer class 1 and order class N and the order have also childs order class 1 and adress class N in hibernate this is realized with a collections. Ok, how can I change the parent of the class order to another customer. When I use remove and use "all-delete-orphan" ,hibernate removes me ...

31. Removing an Entity in ManyToMany reflexive relationships.    forum.hibernate.org

Newbie Joined: Wed Jun 13, 2007 5:44 am Posts: 16 Hi, I'm using Jboss 4.0.5 and Seam 1.2.1 and I'm getting some problem with the EntityManager, trying to remove some Entities. Here's the point. I have an Entity, called Topic, which have a ManyToMany relationship to itself. I decided, regarding my application, to store both children and parents in an entity, ...

33. Urgent help, removing child entity from parent Home object    forum.hibernate.org

Newbie Joined: Tue Nov 25, 2008 9:31 pm Posts: 18 I have entities with realtionship like : -Project entity can have multiple QuantExperiments. -QuantExperiment entity can have multiple Reagents and -Reagent entity can have multiple Treatments. We have a functionality where user clicks a link to remove reagent from QuantExperimentEdit.xhtml. Clicking on "Remove Reagent" removes particular row from ui. But when ...

34. Please help, removing child entity from parent Home object    forum.hibernate.org

I have entities with realtionship like : -Project entity can have multiple QuantExperiments. -QuantExperiment entity can have multiple Reagents and -Reagent entity can have multiple Treatments. We have a functionality where user clicks a link to remove reagent from QuantExperimentEdit.xhtml. Clicking on "Remove Reagent" removes particular row from ui. But when I click "Update Experiment", it removes ALL treatments, ALL reagents, ...

35. Many-to-Many mapping on Set dosnot remove the elements    forum.hibernate.org

Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message gnandigam Post subject: Many-to-Many mapping on Set dosnot remove the elements Posted: Tue Feb 10, 2009 10:04 pm Newbie Joined: Tue Feb 10, 2009 9:48 pm Posts: 1 Hi, I have a User , and UserGroup ...