remove « Entity « JPA Q&A





1. JPA - Removing entities    stackoverflow.com

I have a Story entity with the following associations:

  • Story <1-*> Chapter
  • Story <1-*> Comment
  • Story <*-1> User
What is the correct way of removing this entity and handling the all the entities that is ...

2. JPA Adding Logic to Removing an Entity    stackoverflow.com

I am somewhat new to using JPA -- I'll put that out there right off the bat. I'm getting more familiar with it, but there are big holes in my knowledge ...

3. JPA/Hibernate remove entity not working    stackoverflow.com

I'm using a JPA interface to Hibernate, and I've written some simple code to load an entity from the database and then remove (delete) it. All of my merge calls ...

4. Remove only specific orphans in Hibernate?    stackoverflow.com

In my app I'm using SecurityQuestion entity. There are 5 SecurityQuestions that are hardcoded. User entity holds collection of SecurityAnswer, and SecurityAnswer has one SecurityQuestion reference. Need arised for users to ...

5. JPA/Hibernate remove all in Entity    stackoverflow.com

I have this Entity Class

public class Entity {

    @Id 
    @Column(name="ID")
    private int id;

    @OneToMany(mappedBy="flusso", cascade=CascadeType.ALL, orphanRemoval=true)
   ...

6. How do I make my entity object managed so I can remove it?    stackoverflow.com

This doesn't work -- I always get the IllegalArgumentException thrown with the advice to "try merging the detached and try the remove again."

@PersistenceContext private EntityManager   em;
@Resource    ...

7. (JPA) Correct way to remove entity ?    coderanch.com

Hi! In a project a bug appeared after some "unrelated" changes and we had to add a line of code to fix it. Old code: public void removeFoo(long fooId) { // is an EJB method Foo f = entityManager.find(Foo.class, fooId); entityManager.remove(f); } New code: public void removeFoo(long fooId) { // is an EJB method Foo f = entityManager.find(Foo.class, fooId); f.getBar().getFoos().remove(f); // ...

8. (JPA) Correct way to remove entity ?    forum.hibernate.org

@Entity @Table( name = "TBL_FOO" ) public class Foo implements Serializable { @ManyToOne( fetch = FetchType.EAGER ) @JoinColumn( name = "BAR_ID", nullable = false, insertable = true, updatable = true ) private Bar bar; // rest snipped } // in other file: @Entity @Table( name = "TBL_BAR" ) public class Bar implements ...

9. Entities constructed from views - remove?    forum.hibernate.org





10. Removing entities    forum.hibernate.org

I have this problem. Let's have two entities, for example Car and Person. One person can own n cars, a car can be owned by one person, so it's one-to-many association. The association is unidirectional, you can obtain owner from Code: Person Car.getOwner() , but you can't get list of cars from Person. And now here's the problem. I need to ...

11. Saving and Entity that was removed (EntityNotFoundException)    forum.hibernate.org

Beginner Joined: Thu Feb 22, 2007 6:08 am Posts: 35 Hi there! Im developing a backend with an Applet as a frontend. And i am with a problem persisting a entity. When an entity is created (new operator, that create a entity with out id, and properties are setted) on the client side, it is passed to to the servlet where ...

12. StaleObjectStateException after removing two entities    forum.hibernate.org

The szenrio is very simple : we have two entities EntityA, EntityB with a relation (EntityA.eB <-> EntityB.eA) between them. The foreign key 'eB_id' is located at the table of EntityA. The Lock-Strategy of both Entities is Code: @org.hibernate.annotations.Entity(optimisticLock = org.hibernate.annotations.OptimisticLockType.DIRTY, dynamicUpdate = true) The initial state can be reached as follows: Code: @PersistenceContext EntityManager m; public void create() { ...

13. Cannot remove a entity from a collection. [RESOLVED]    forum.hibernate.org

When i try: Code: regra = grupo.getRegras().remove(i); tx = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction(); factory.getRegraDAO().delete(regra); factory.getGrupoDAO().update(grupo); tx.commit(); I receive the follow exception: Code: Exception occurred during event dispatching: org.hibernate.exception.GenericJDBCException: could not update collection rows: [especialista.regra.Grupo.regras#1] Maps: Code: ...

14. How to persist a removed entity    forum.hibernate.org