delete « JPA « Spring Q&A





1. How to batch delete using bulkUpdate    stackoverflow.com

I have a common User / Role setup, with a user_role join table. I'm trying to use Spring's HibernateTemplate to mass delete all locked users like this:

getHibernateTemplate().bulkUpdate("delete from User where locked=?", ...

2. JPA parent child delete problem    stackoverflow.com

I have two entities:

@Entity
public class Game implements Serializable{

@ManyToOne
@JoinColumn(name = "target_id")
protected GameObject target;
}

@Entity
public class GameObject implements Serializable {

@OneToMany(mappedBy = "target", cascade = CascadeType.ALL)
protected Collection<Game> games = new HashSet<Game>();    
}
In ...

3. ManyToMany assoicate delete join table entry    stackoverflow.com

I use these two entities to create a new user and groups it associates:

@Entity  
@Table(name="usertable")  
@SuppressWarnings("serial")  
@Searchable  
public class User implements Serializable {  

  ...

4. Spring hibernatetemplate: delete caches?    stackoverflow.com

I'm writing a test to see if my getHibernateTemplate().delete(x) works. Now I've discovered that in a single test there seems to be some caching (my test class extends extends AbstractTransactionalDataSourceSpringContextTests). What I ...

5. Hibernate performs a Delete on a Select    stackoverflow.com


I'm facing a problem with Hibernate. My current project is a little game. In this game you have a Board which has many Fields each with a Token.
I can make a select ...

6. JPA thinks I'm deleting a detached object    stackoverflow.com

So, I've got a DAO that I used to load and save my domain objects using JPA. I finally managed to get the transaction stuff working (with a bunch of help ...

7. JPA returning null for deleted items from a set    stackoverflow.com

This may be related to my question from a few days ago, but I'm not even sure how to explain this part. (It's an entirely different parent-child relationship.) In my interface, ...

8. Spring/Hibernate: InvocationTargetException when deleting entity    stackoverflow.com

I'm sorry if this question is a bit vague, but I'm quite confused. I've got a controller that calls a service to delete an entity and then create an entity in its ...

9. StaleObjectstateException row was updated or deleted by     stackoverflow.com

I am getting this exception in a controller of a web application based on spring framework using hibernate. I have tried many ways to counter this but could not resolve it. In ...





10. Prevent data from being deleted after test run with Hibernate / Spring / Maven / MySQL    stackoverflow.com

I am using Hibernate / Spring / Maven / MySQL and unit tests with JUnit. Up to yesterday, my testdata persisted in the database even after the test run was completed. ...

11. Spring and Hibernate: can't delete entry    stackoverflow.com

I stuck with entry deleting an entry from DB. I have Hibenrnate integrated with spring. RDMS is HyperSql and application server is Tomcat 6. For dependency management I use maven and ...

12. Unable to delete using Spring MVC and Hibernate    stackoverflow.com

I have a simple delete method, it gets the id from a table that lists all from the db:

@RequestMapping(value = "/personagem/excluir.htm")
public ModelAndView doExcluir(@RequestParam("id") int id) {
    logger.info("Recebendo parametro: ...

13. Deleting objects with FK constraints in Spring/Hibernate    stackoverflow.com

This seems like such a simple scenario to me, yet I cannot for the life of my find a solution online or in print. I have several objects like so (trimmed ...

14. Object is not deleting in spring and hibernate setup while jUnit test. Strange problem!    stackoverflow.com

I am facing a strange and quite occuring problem. I am working on project with Spring and Hibernate. I have written a test with jUnit to Insert/ read / delete then ...

15. StackOverflowError while reading then deleting object with hibernate    stackoverflow.com

I am reading an objects and then simply deleting it and it throws java.lang.StackOverflowError!

public class TestDummy extends TestCase {

    @Autowired
    private ApplicationContext context;

   ...

16. Spring Mvc Controller - problem with delete    stackoverflow.com

i working in a j2ee project (pojo layer, Dao layer(hibernate), Service Layer(spring), View(spring mvc)) i have a table of articles after each row i want to add a link to remove it. this ...





17. Cannot delete entity (JPA & Spring)    stackoverflow.com

What ever I try, I cannot delete a user entity when I call delete() from my userService class. I get an exception java.lang.IllegalArgumentException: Entity must be managed to call remove: com.blackbox.genesis.entities.User@30168a, ...

18. Delete related Object in Hibernate and Spring    stackoverflow.com

I have a Person that has a List of Cars, in my database I have 2 tables for this:

Person [id(PK), name, etc...]
Car [id(PK), personId(FK), colour, etc...]
So when I remove one ...

19. why JPA can save my entity but It can't delete the entity?    stackoverflow.com

In my JSF2-JPA2-Spring3 project, I can insert new entities but can't remove entities. This is the error message: java.lang.IllegalArgumentException: Removing a detached instance entity.Entity#8 This is my persistence.xml:

<?xml version="1.0" encoding="UTF-8" ?>
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" ...

20. How to delete entities using Criterion efficiently?    stackoverflow.com

Currently, I have to create a temporary Criteria and get the matching entity list using Criteria.list(), and then, pass the list to HibernateTemplate.deleteAll():

void delete(Criterion criterion) {
    Criteria c ...

21. Hibernate @ManyToMany uses only FK from owning table to remove entries in connection table    stackoverflow.com

I have @ManyToMany relationship of Author and Source entities, where Author is owning entity. When I remove author everything is OK and hibernate generates Hibernate: delete from author_source where author=?. But ...

22. Spring JPATemplate DAO. DELETE Items from table    stackoverflow.com

News

@Entity
@Table(name = "NEWS")

@NamedQueries({
    @NamedQuery(name = "News.findAll", query = "SELECT n FROM News n"),
    @NamedQuery(name = "News.delete", query = "DELETE FROM News n WHERE n.newsId in(:ids)")
})

@GenericGenerator(name ...

23. Hibernate cascade="all-delete-orphan", doesn't delete orphans    stackoverflow.com

I am having trouble deleting orphan nodes using Hibernate with the following mapping

@OneToMany(fetch = FetchType.LAZY, mappedBy = "seizure",orphanRemoval=true)
@JsonManagedReference  
@Cascade({CascadeType.ALL,CascadeType.DELETE_ORPHAN})
public Set<SubstanceIdentified> getSubstanceIdentifieds() {
    return this.substanceIdentifieds;
}
the .hbm.xml mapping is ...

24. Hooking custom actions when deleting cascadingly    stackoverflow.com

A simple case. A user has many photos. When a user gets deleted, all of his/her photos should be deleted too (rule of cascades). I want however to be able to execute ...

25. hibernate HQL delete query nullifies single column    stackoverflow.com

I am working on spring hibernate application and trying to delete from a table using non-id many-to-one relationship based column. Entity classes are:

@Entity  
public class Day {  
@id(name ...

26. Hibernate / Spring - Exception propogates after already caught    stackoverflow.com

I'm having the strangest thing happening and I can't figure out why. The best way to describe this is to provide a simplistic example:

@Service
@Transactional
public class Foo{
    public ...

27. Cannot delete or update a parent row: a foreign key constraint fails    forum.springsource.org

Cannot delete or update a parent row: a foreign key constraint fails When running the unit tests, I get a bunch of messages like: Code: 2011-02-02 07:41:15,982 [main] ERROR org.hibernate.util.JDBCExceptionReporter - ...

28. Spring MVC Search Criteria retain values and delete check box    forum.springsource.org

Spring MVC Search Criteria retain values and delete check box Hi, I am new to Spring MVC and having been using Spring 2.5 for developing one application. I am having a ...

29. CascadeType.DELETE_ORPHAN} vs orphanRemoval = true    forum.springsource.org

Hi there, i have a issue about cascadeType.DELETE_ORPHAN, the IDE tell me that this is deprecation, is true , I always use for this orphanRemoval = true? Code: @OneToMany(targetEntity=Transportista_Ubigeo.class, orphanRemoval = ...

30. Problem with Hibernate. I can't delete a record from table in my DB    forum.springsource.org

Aug 5th, 2011, 09:49 AM #1 cecce88 View Profile View Forum Posts Private Message Junior Member Join Date Aug 2011 Posts 3 Problem with Hibernate. I can't delete a record from ...

31. Insert Update and Delete in single query using HibernateTemplate    forum.springsource.org

Insert Update and Delete in single query using HibernateTemplate I want to Insert/Update/Delete from DB in a single query using Hibernate template then which query do i need to use? I ...

32. getHibernateTemplate().delete errors    forum.springsource.org

getHibernateTemplate().delete errors Hi I search the forums and example code on how to use getHibernateTemplate().delete(entity);, but could not find it. So here goes: I'm using LocalSessionFactoryBean, DriverManagerDataSource, and HibernateTransactionManager in pretty ...

33. Hibernate cascading delete problem    forum.springsource.org

Hibernate cascading delete problem Hi all, I'm having trouble finding a way to catch an error when trying to cascade deletes. Code: persistence setup --database MYSQL --provider HIBERNATE --userName root --password ...

34. Delete references to other objects without cascading    forum.springsource.org

Hibernate: delete from student where id=? and version=? 2011-09-19 15:25:10,317 [http-8080-3] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot delete or update a parent row: a foreign key constraint fails (database.student_course, CONSTRAINT FKF8A06F72970A31AF FOREIGN KEY ...

35. Hibernate deleting row with getHibernateTemplate().find---Completely confused    forum.springsource.org

Hibernate deleting row with getHibernateTemplate().find---Completely confused Hi, I need real help with this. I am using a Many-To-Many relationship with Users and Role tables. Following are the classes. UserID is the ...

36. Suggestion for HibernateTemplate - delete(Class, Object pk)    forum.springsource.org

How about adding a new convenience method to HibernateTemplate? Code: public void delete(final Class entityClass, final Object primaryKey) { execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Object entity ...

37. delete object fail,Duplicate key or integrity constraint    forum.springsource.org

delete object fail,Duplicate key or integrity constraint Hi everyone: I want to delete an Object from database.My code is: Code: public void deleteObj(final Class clazz,final Serializable objID) throws DataAccessException { // ...

38. Deleting objects with the Hibernate3 Query API    forum.springsource.org

Deleting objects with the Hibernate3 Query API Hi, I am trying to implement a delete operation with the following semantics: public int delete...(String id) Where the method returns the number of ...

39. hibernate:how to delete object from a set when using inverse    forum.springsource.org

hibernate:how to delete object from a set when using inverse how to delete or clear object from a set when using inverse="true" Code: StringBuffer hql = new StringBuffer(); hql.append(" select authorities ...

40. Spring/Hibernate Delete/Update Problem    forum.springsource.org

Spring/Hibernate Delete/Update Problem Hello, I am using Spring 1.2.1 + Hibernate 3.05 and quite new to it. In my first version all worked quite well, except of lazy initialization. So i ...

41. org.hibernate.HibernateException: Unexpected row count: 0 expected: 1 on delete    forum.springsource.org

org.hibernate.HibernateException: Unexpected row count: 0 expected: 1 on delete Hi All, I am using Hibernate3 with springframework-1.2.3 When I try to delete a record which doesn't exists with the following code ...

42. Hibernate3 support missing delete( String instancename, Object obj) overload?    forum.springsource.org

Hibernate3 support missing delete( String instancename, Object obj) overload? I don't see an overload of delete() which takes the String entityname parameter... am I missing something, or is it really not ...

43. Delete with Hibernate and Spring    forum.springsource.org

Delete with Hibernate and Spring Hello, I am newbie with Spring and Hibernate. I read much about these Contents but now I first start to deal with the technologie. Please can ...

44. Spring / Hibernate delete problem 'unknown entity'    forum.springsource.org

Spring / Hibernate delete problem 'unknown entity' Hello All, We have been using spring 2 with hibernate 3 and when we try to delete an object we get this error: Unknown ...

45. Hibernate soft delete on DataIntegrityViolationException    forum.springsource.org

Hibernate soft delete on DataIntegrityViolationException I am hoping there is someone out there that can help me with a problem we are having using hibernate with some legacy code. The general ...

46. JPA+Toplink+oracle10g+MVC can't save, update or delete    forum.springsource.org

JPA+Toplink+oracle10g+MVC can't save, update or delete This is a simple CRUD app using JpaDaoSupport. I can do integration test without any problem. But when I try to run Spring MVC with ...

47. Spring Hibernate Delete    forum.springsource.org

Spring Hibernate Delete Hi I've got a list which is displayed on my screen. I have to edit/delete an item but how does the controller know what I want to do? ...

48. Can anyone spot the error on this HQL delete statement?    forum.springsource.org

delete Relationship r left join r.userA a left join r.userB b where (a.id=:aid and b.id=:bid) or (a.id=:bid and b.id=:aid)

49. Cascade delete overspill?    forum.springsource.org

Mar 22nd, 2007, 11:42 AM #1 jamesdavit View Profile View Forum Posts Private Message Junior Member Join Date Mar 2007 Posts 20 Cascade delete overspill? Hi all, I'm new to Hibernate ...

50. spring hibernate delete column    forum.springsource.org

spring hibernate delete column Hi all, I want to delete a bunch of rows in a table. the native sql query is something like this delete form content where id = ...

51. Hibernate Annotations Has Deleted My Entire Database!!!!!    forum.springsource.org

Hibernate Annotations Has Deleted My Entire Database!!!!! Now i write what happens a few minutes ago. Hope you dont run in this trap. I have added the hibernate-commons-annotations, ejb3-persistence and the ...

52. Delete using a composite-key (Spring/ Hibernate)    forum.springsource.org

Delete using a composite-key (Spring/ Hibernate) Hello, This is a so simple operation, but I think I am little lost with some concepts. Let's say that I have product and item ...

53. cannot delete via Hibernate Query    forum.springsource.org

This is probably a very basic question, but I am not sure what I am doing wrong here. I am trying to delete an entry off a table via hibernate: String ...

54. Cascasde Delete in Hibernate does not work    forum.springsource.org

Jun 20th, 2007, 12:33 AM #1 sshah View Profile View Forum Posts Private Message Member Join Date Mar 2007 Posts 64 Cascasde Delete in Hibernate does not work Hello, I have ...

55. Soft Delete @Filter ann. on @OneToMany association not working    forum.springsource.org

Soft Delete @Filter ann. on @OneToMany association not working Hi All, Thanks in advance to any pointers and info. I have a DB schema design which uses Soft/virtual Deletes where every ...

56. getHibernateTemplate().delete() not working on 2.0.6 version    forum.springsource.org

getHibernateTemplate().delete() not working on 2.0.6 version Hi everyone I updated the frameworks on my project, and the delete method from hibernate template is not working. On the SQL log, there is ...

57. Why HibernateTemplate executes insert before delete?    forum.springsource.org

Dear all I declare Transaction Management in Spirng configuration and call HibernateTemplate delete method before save method in my program. But the log shows that the program executes save method first ...

58. Why getHibernateTemplate().delete calls update before deleting    forum.springsource.org

Why getHibernateTemplate().delete calls update before deleting Hi All This is my table SUG_GROUP_ID Number(8) GROUP_NAME Varchar2(10) DESCRIPTION Varchar2(50) SUG_SCHEME_CODE Varchar2(15) STAUS Varchar2(10) MAX_MEMBERS Number(5) all the fields are defined as NotNull ...

59. Key Board arrows don't work on Sample Simple 'Confirm Delete'    forum.springsource.org

Hello, I could n't find a way to put key board left and right arrows on 'Confirm Delete' in Sample application (Simple Sample App @Contacts View) Is there a way to ...

60. Unable to Save/update/delete by using HibernateDaoSupport    forum.springsource.org

Unable to Save/update/delete by using HibernateDaoSupport Hi All, I am new to Springs and Hibernate Technologies so i am trying to learn them. I wrote one sample DAO which extends HibernateDaoSupport ...

61. How to delete all records using JPA Query Language?    forum.springsource.org

How to delete all records using JPA Query Language? Why is JPA complaining about my statement (see it imbedded in the error message): code: Caused by: Exception [TOPLINK-8024] (Oracle TopLink Essentials ...

62. Can't delete entity in a @OneToOne    forum.springsource.org

Hi everyone, I'm think i'm trying to do something exotic, because i cant find a good solution. I have een Entity called Form. a From can contain a HelpTopic. this is ...

63. Issue with the Delete operation in Hibernate    forum.springsource.org

Issue with the Delete operation in Hibernate Were facing a problem while deleting records from a table using Hibernate. Object obj = dao.read( ID ); Dao.delete( obj ); This object obj ...

64. Multiple level deleting using Hibernate in Spring    forum.springsource.org

May 30th, 2008, 11:54 AM #1 saadnabs View Profile View Forum Posts Private Message Junior Member Join Date May 2008 Location London, United Kingdom Posts 25 Multiple level deleting using Hibernate ...

65. Child gets deleted when using AbstractTransactionalDataSourceSpringContextTests and H    forum.springsource.org

Child gets deleted when using AbstractTransactionalDataSourceSpringContextTests and H Hi all, I am using AbstractTransactionalDataSourceSpringContextTests of Spring and Hibernate. I am trying to test the save operation of my Parent and child ...

66. JPA delete problem on @OneToMany: deleted entity passed to persist    forum.springsource.org

JPA delete problem on @OneToMany: deleted entity passed to persist Dear All, I get this urgent problem: Code: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Error while commiting ...

67. Hibernate Delete Issue    forum.springsource.org

Hibernate Delete Issue Hi, I am facing issue in Hibernate Delete. Following WORKS: Code: Session session = getHibernateTemplate().getSessionFactory().openSession(); session.createQuery("delete from com.xxx.GitUser A where A.userId=144").executeUpdate(); Following DOES NOT work: Code: GitUser user1 ...

68. Delete a table with an entitymanager in a tasklet    forum.springsource.org

Delete a table with an entitymanager in a tasklet Hi, I try to delete a table with an EntityManager from hibernate. My step implement taskletStep : Code: ...

69. unable to delete Child objects    forum.springsource.org

unable to delete Child objects Provision.java ------------------ private Date creationDate; private String createdBy; private Date lastUpdatedDate; private String lastUpdatedBy; private String allowedModules; provisionHubModel extends Provision ---------------------------------------------------- private String name; private Set ...

70. delete entity in hibernate    forum.springsource.org

delete entity in hibernate Hi I have a problem with this test case : Code: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:**/applicationContext-all.xml"}) @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) @Transactional public class PasswordDaoTest { @Test ...

71. NoSuchMethodError: HibernateTemplate.delete    forum.springsource.org

NoSuchMethodError: HibernateTemplate.delete I'm having a frustrating problem using hibernate template that I can't understand, I'll do my best to explain it. I have 3 projects, BaseFramework, WebFramework, and Web, all using ...

72. Hibernate One Shot Delete instead of many single Delete Statements    forum.springsource.org

Hibernate One Shot Delete instead of many single Delete Statements Hi, i know my question relates to hibernate and not spring. But i hope i can use this forum as i ...

73. Please help: Error deleting foreign key objects usign triggers and hibernate template    forum.springsource.org

Please help: Error deleting foreign key objects usign triggers and hibernate template Hi, I have a two tables t_profile and t_loan where t_loan has a standard foreign key relationship with t_profile ...

74. Dynamic Bean creation using Child Bean Factory and deleting them    forum.springsource.org

Hello, I have a strange requirement. For the current application I'm working on, most of the beans definitions come statically from a spring context file. But during run-time, the user may ...

75. Delete associations to parents automatically (cascade)?    forum.springsource.org

Delete associations to parents automatically (cascade)? Hi guys! I have this class Tag that has a set of children Tag objects. A tag can be child of more than one tag. ...

76. Hibernate - can you control cascade DELETE programmatically?    forum.springsource.org

Hibernate - can you control cascade DELETE programmatically? I have the following scenario in Hibernate: Tables: ------- TAG (one-to-many) TAGGED_ARTICLE (many-to-one) ARTICLE When I delete a TaggedArticle (Im using HQL) I ...

77. Spring + hibernate can't delete, update, save    forum.springsource.org

Spring + hibernate can't delete, update, save Hello everyone. I'm a newbie in Spring. I am Using Spring 2.5, Hibernate 3.2 and MySQL 5.1.32 (included in wamp 2.0) This is my ...

78. how to syncronize delete on tables in hibernate    forum.springsource.org

how to syncronize delete on tables in hibernate Im using hibernate 3 with spring and I have the an issue, i have a simple many to many relation in the tables ...

79. Hibernate Named Query for insert ,update and delete    forum.springsource.org

I am able to call the named query for select of native and object queries using select... tag and I am trying to implement the Named query for insert,update ...

80. orphan delete for @oneToOne    forum.springsource.org

What does the book say exactly? The reference manual discusses delete orphan in respect to the lifecycle of the parent, depending on what that is really depends on what you want ...

81. Weird behavior with JPA on deleting child attributes    forum.springsource.org

Weird behavior with JPA on deleting child attributes Hi guys, I have a service method which retrives an entity and then performs an update on a child of that entity. One ...

82. Hibernate Newbie: Current data getting deleted    forum.springsource.org

Hi Folks, Complete hibernate newbie here. I've set up a small web app using hibernate, spring etc. This is all up and running and I can't see any issues apart from ...

83. Issue with JpaTemplate deleting all records in Table    forum.springsource.org

Nov 8th, 2009, 02:43 PM #1 mickknutson View Profile View Forum Posts Private Message Visit Homepage Senior Member Join Date Jun 2005 Location Philly Posts 199 Issue with JpaTemplate deleting all ...

84. Hibernate Cascade delete    forum.springsource.org

if i do this, it will delete the parent + children.. but it wont delete the children of children.. even if i include cascade all delete orphan to ...

85. Delete, Modify field, delete entity    forum.springsource.org

Hi, I think about having a command to delete field and entity from Roo shell. Also update field in an entity, is this possible ?

86. Deleting entities while adding Float type    forum.springsource.org

Deleting entities while adding Float type I am working on the tutorial from Roo and whenever I add this Float type to the PizzaOrder class the associated Aspects are deleted. I ...

87. deleting entity    forum.springsource.org

deleting entity Hi ! When I manually delete an entity Roo doesn't take care of test classes / web layer. Therefore in the next build the controller fails and related data ...

88. jpa retrieves reference to deleted entity?    forum.springsource.org

jpa retrieves reference to deleted entity? I have the following (simplified) entity structure: Code: @Table(name = "purchase_request", schema = "public") public class PurchaseRequest { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy ...

89. Hibernate delete with criteria    forum.springsource.org

Hello. I am trying to delete a register with a restrinction. Example: Delete from house where table = 'blue'; How can I do it with criteria?. I've been reading some posts ...

90. StaleStateException during cascade delete    forum.springsource.org

May 19th, 2010, 05:01 AM #1 oakstair View Profile View Forum Posts Private Message Junior Member Join Date Feb 2008 Posts 5 Bug in Hibernate?: StaleStateException during cascade delete Please help ...

91. ManyToMany and deleting inverse side object    forum.springsource.org

I have following entities: User: Code: @ManyToMany(mappedBy="members", fetch=FetchType.EAGER) private Set projects; Project: Code: @ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER) @JoinTable(name = "project_user", joinColumns = @JoinColumn(name="project_id"), inverseJoinColumns= @JoinColumn(name="user_id")) private Set members; Now deleting Project ...

92. Delete +Update not working in OnetoMany    forum.springsource.org

Aug 2nd, 2010, 09:43 AM #1 spring2007 View Profile View Forum Posts Private Message Member Join Date Aug 2007 Posts 33 Delete +Update not working in OnetoMany I am trying to ...

93. Problem with deleting ( JPA, Hibernate)    forum.springsource.org

Problem with deleting ( JPA, Hibernate) Hi, I got a simple relationship like Code: @ManyToOne(optional = false, fetch = LAZY) @JoinColumn(name = "id_poll") private Poll poll; and Code: @OneToMany(mappedBy = "poll", ...

94. Object not deleting with Spring    forum.hibernate.org

96. Hibernate + Spring can't delete, update, save    forum.hibernate.org