1. Order of Hibernate delete queries stackoverflow.comHere is my data model (simplified)
|
2. Java: Hibernate - Query to delete from multiple tables stackoverflow.comi have two tables connected by a foreign key with a one to many relation. in entity A i have the following :
|
3. query must begin with SELECT or FROM: delete [delete stackoverflow.comI am using JPA in addition to spring(3.0.0.M4). While deleting multiple records using
|
4. Hibernate; HQL; why does the delete query not work, but select does? stackoverflow.comI want to delete certain records from a table. These records have some child-records in other tables. In order to be able to delete the main records, I have to delete ... |
5. Deleting orphans with JPA stackoverflow.comI have a one-to-one relation where I use CascadeType.PERSIST. This has over time build up a huge amount of child records that has not been deleted, to such an extend that ... |
6. JPA Native Query delete in stackoverflow.comI try to delete a list of rows from a table using this Native Query: @NamedNativeQuery(name="WebGroup.DeleteIn", query="DELETE FROM WebGroup WHERE WebGroup.GROUP_ID IN (:IDsList)" getEm().createNamedQuery("WebGroup.DeleteIn") ... |
7. JPA 2 Delete/Insert order from Metamodel stackoverflow.comI'm trying to use the JPA2 metadata to figure out the order to insert/delete rows from a database so constraints are not an issue (to be used later in Java code). ... |
8. Why does this HQL delete fail, when an HQL select with same terms works? stackoverflow.comWhy does the following HQL query fail?
|
9. [platform-dev] JPA 2 Delete/Insert order from Metamodel forums.netbeans.org |
10. Hibernate does delete and insert during a find. coderanch.comI try to figure out why hibernate does insertes and deletes while I'm actually doing a select. In our app. hibernate does a search on a user with a given username to retrieve the userobject (Hibernate.find()). During this search it does 4 selects, 1 delete(?!) and 2 inserts(?!). The usertable has a many-to-many connection with a grouptable. So when I retrieve ... |
11. Hibernate (HQL Delete Query) coderanch.comHi, Please help me in writing HQL delete query. My entity Class is like this public class FunctionResourcePermissionData implements java.io.Serializable { // Fields private FunctionResourcePermissionId id; private CompositeResourceData resourceObject; private FunctionData function; private String permissionCode; private Date recordCreationTimestamp; private String recordCreationUserId; private Date lastUpdateTimestamp; private String lastUpdateUserId; The Id class is public class FunctionResourcePermissionId implements java.io.Serializable { // Fields private Integer ... |
12. Hibernate: Does not refresh after deletion coderanch.comHi there. I have a parent and child relationship. If I delete the child, it does not reflect immediately in the application. I need to log-out and log-in back to the system to see the actual result. Here's the mapping in parent: |
13. getting Problem in hibernate delete Query... coderanch.com |
14. Delete Query in hibernate doesnt work coderanch.comI am a newbie to hibernate 3...I have a problem associated with the hibernate delete query..... when i execute the delete query it returns a 'null'.... My program to delete the query is import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class DeleteHQLExample { public static void main(String[] args) { Session session = null; try { SessionFactory sessionFactory ... |
15. Hibernate: IN clause when deleting coderanch.comHello! I have an entity User: @Entity @Proxy(lazy=false) public class User{ @Id int id; protected String name; } I'd like to delete some users from a list of ids (List |
16. Hibernate HQL Delete query problem coderanch.comFollowing are my entity classes: class SampleEntityA { private Long id; private List |
17. Extra inserts & deletes during select forum.hibernate.org |
18. Using Native SQL Query deletes the second level cache forum.hibernate.orgNewbie Joined: Thu Jul 28, 2011 10:06 am Posts: 1 Hi, In our project, I observed that when we use Native SQL query for any DML statement, the entities in second level cache were evicted. Could someone please provide some insight into avoiding this scenario without any performance impact? From my analysis: When I used a profiling tool to identify the ... |
19. Hibernate Criteria query returns deleted objects forum.hibernate.orgcreateCriteria returns an object deleted by previous session.delete(). When we try to update object returned by createCriteria, this update fails. createCriteria should not return deleted objects (at least it was not in Hibernate 2) Hibernate 3.6.8 is used. Both session.delete() and createCriteria are in the same session and parts of the same transaction. Is it Hibernate bug? Any workaround for this ... |
20. Delete by Named Query forum.hibernate.org |
21. problems with delete(query) forum.hibernate.orgPlease read the documentation and API Javadoc for Session.delete(): delete(String query) Delete all objects returned by the query. delete(String query, Object[] values, Type[] types) Delete all objects returned by the query. delete(String query, Object value, Type type) Delete all objects returned by the query. You use a query string like "from myClass foo where foo.someAttribute = ?" and then bind a ... |
22. session.find after session.Delete problem forum.hibernate.orgI have the following code: Code: Session session = null; try { // get factory and open session SessionFactory factory = HibernateConfiguration.getInstance().getFactory(); session = factory.openSession(); // create rule list Transaction ... |
23. HQL Help with SELECT and DELETE forum.hibernate.orgI have read through the documentation and posts, and I can't find what I need. I would like to execute SELECT * FROM table_name and DELETE FROM table_name. I have tried the following: find("SELECT * FROM table_name"); delete("SELECT * FROM table_name"); Can someone tell me what the equivalent HQL statements are? Thanks! |
24. delete vs find+delete forum.hibernate.orgpublic int delete(String query, Object[] values, Type[] types) throws HibernateException { if ( log.isTraceEnabled() ) { log.trace( "delete: " + query ); if (values.length!=0) log.trace( "parameters: " + StringHelper.toString(values) ); ... |
25. Query Cache invalidation on insert/delete? forum.hibernate.orgAre cached queries supposed to be invalidated when hibernate inserts or deletes a persistent object? If not, it sure makes the query cache less transparent than it could be. I suppose I can think of instances when it'd be preferable to keep a stale query around for performance reasons rather than return stale data, but in my mind, those are exceptions ... |
26. All HQL delete is preceded by a select? forum.hibernate.org02:37:35,796 INFO [STDOUT] Hibernate: select sistema0_.id as id, sistema0_.descricao as descricao, sistema0_.nome as nome, sistema0_.operadorInclusao as operador4_, sistema0_.data HoraInclusao as dataHora5_, sistema0_.operadorAlteracao as operador6_, sistema0_.dataHoraAlteracao as dataHora7_, sistema0_.versaoRegistro as versaoRe8_ from Sistema sistema0_ wher e (sistema0_.id=10 ) 02:37:35,843 INFO [STDOUT] Hibernate: select perfis0_.id as id__, perfis0_.sistemaId as sistemaId__, perfis0_.id as id0_, perfis0_.descricao as descricao0_, perfis0_.nome as nome0 _, perfis0_.sistemaId ... |
27. Query Delete forum.hibernate.orgHi, I need to fire SQL "DELETE" Statements from our Application. I would most preferably do this using NamedQuerys. This is not possible currently right? Is the a timescale of this feature? Is there an alternative way how to do this? Maybe anyone can explain to me how to fire a direct JDBC-Query using the Hibernate Session Connections? Regards, Alex |
28. delete(Query) not available on Session interface? forum.hibernate.orgI am new to Hibernate, but I think I am getting along fairly well for only using it for a week. I like the idea of storing queries in the *.hbm.xml files, but I can't figure out why I can't call session.delete() using a Query object. All signatures only accept strings. Thanks! DeVon |
29. session.delete(query) forum.hibernate.orgLooks like you are having fun learning too! Here's what I did... I did a query.list() to retrieve a list of all objects that satisfy the query, then call session.delete(Object) on each of them. If you're not familiar with query.list, you can also use either session.find() for a full list of objects all in memory at the same time, or session.iterate() ... |
30. HQL Delete Query with Named Parameters forum.hibernate.org |
31. Hibernate is reexecuting a delete query forum.hibernate.orgI having trouble finding out what I am doing wrong. I'm trying to delete an object using session.delete, and it fails because this object is refered by other objects. I catch the exception thrown in commit, and I rollback the transaction. After that, my app is still running, but anything I do, like an insertion, at commit time hibernate tries again ... |
32. Select 'hibernate-2.1', Press 'Delete' forum.hibernate.org |
33. deleting with query forum.hibernate.orgbertrand wrote: My two cents... (not tested ;) - why don't you just do: Code: query.uniqueResult() Bertrand, you'll have to show me what you mean; I tried 2 or 3 variations of query.uniqueResult() and couldn't get it to work. Simon, This has been on my mind because I'm trying to get my head around what Hibernate is all about. Coming from ... |
34. No persister exception upon delete with query forum.hibernate.orgException: No persister for: java.lang.String org.springframework.orm.hibernate.HibernateSystemException: No persister for: ja va.lang.String; nested exception is net.sf.hibernate.MappingException: No persis ter for: java.lang.String net.sf.hibernate.MappingException: No persister for: java.lang.String at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryI mpl.java:344) at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java: 2686) at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2693) at net.sf.hibernate.impl.SessionImpl.delete(SessionImpl.java:1133) at org.springframework.orm.hibernate.HibernateTemplate$14.doInHibernate( HibernateTemplate.java:295) at org.springframework.orm.hibernate.HibernateTemplate.execute(Hibernate Template.java:150) at org.springframework.orm.hibernate.HibernateTemplate.delete(HibernateT emplate.java:293) at com.cnetnetworks.service.psp.catalog.test.HibernateCatalogDaoAdminImp lTest.deleteTable(HibernateCatalogDaoAdminImplTest.java:34) at com.cnetnetworks.service.psp.catalog.test.CatalogDaoImplTest.testDele te(CatalogDaoImplTest.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) |
35. DELETE then INSERT in collection - Order of executed SQL forum.hibernate.orgHibernate version: 2.1.4 A question related to updating a collection: According to the manual, this is the order of how SQL is executed: Quote: 1. all entity insertions, in the same order the corresponding objects were saved using Session.save() 2. all entity updates 3. all collection deletions 4. all collection element deletions, updates and insertions 5. all collection insertions 6. all ... |
36. delete-orphan not behaving like the all-delete-orphan??? forum.hibernate.orgAll I am doing is clearing out the collection. I happen to have a table of 2 items. I get the 1st item whose primary key is 1(I added it to the db myself). With the option of delete-orphan, the orphan is not deleted even though I removed the reference from the collection. Once I switch to all-delete-orphan, the below code ... |
37. Hibernate3: Problems with delete("from...") query forum.hibernate.orgHibernate version: 3.0 I am using Hibernate 3.0 Spring. I have a simple Java bean as follows: Product.java ----------------------------------- public class Product { private int id; private String name; //getters and setters follow ... } The mapping document looks like this: Product.hbm.xml ------------------------------------ |
38. hibernate 3 and session.delete(query) forum.hibernate.orgsession.createQuery(...).executeUpate() [sic] *should* do the trick, but personally I've had no luck with it, at least using the old query parser. YMMV with the new query parser; alternatively, you could get the connection from the session and do this with straight JDBC. (Bulk-delete is not really within the remit of ORM) HTH Satish |
39. Delete order / Nullable checks on delete forum.hibernate.orgHibernate version: 2.1.8 I currently have the following scenario : Class A manages a list of Class B (all-delete-orphan), and Class M manages a list of Class N (all-delete-orphan). B references N (not-null). Now...if i remove an instance of B from A, it gets deleted because of the cascading. The same holds true for removing N from M. the problem comes ... |
40. insert/update/delete (DML) outside Hibernate-refresh cache? forum.hibernate.org |
41. Hibernate way to execute delete query a select subquery forum.hibernate.orgHi, I wanted to execute a query which goes like this, delete from |
42. Deletion approach using named query forum.hibernate.orgHi, I have following delete query. delete from userid where useraccontno in (1,2,3,4,5); I am looking for a nice solution to implement above using named query. Parameters of this queries are the one specified in brackes (1,2,3,4,5), using "in" SQL clause. For this I am defining above query in .hbm file |
43. log4j would like to only see updates,inserts and deletes forum.hibernate.orgCaused by: org.springframework.orm.hibernate.HibernateSystemException: a different object with the same identifier value was already associated with the session: 1165, of class: com.*****.model.businessobject.ServiceJobCrane; nested exception is net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 1165, of class: com.*****.model.businessobject.ServiceJobCrane .. Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: ... |
44. select after delete behavior unclear forum.hibernate.orgHibernate version: 3.1.3 Code between sessionFactory.openSession() and session.close(): Session hsession = HibernateUtil.openSession(); hsession.flush(); hsession.clear(); HibernateUtil.getSessionFactory().evict(T.class); t = hsession.createQuery("select t from T as t").list(); System.out.println("T: "+t.size()); Transaction tx = hsession.beginTransaction(); tx.commit(); t = hsession.createQuery("select t from T as t").list(); System.out.println("T: "+t.size()); Name and version of the database you are using: MySQL 5 Here's the output: 19:19:20,149 INFO [STDOUT] T: 1 19:19:20,149 INFO ... |
45. Delete Query forum.hibernate.orgHi i am trying to delete record from the table. The query i am passing to createQuery is... DELETE from T_Appl_Acct_Grp_Dtl where ( group_Id = 1 and role_Code = 'HSP' and level1 = '0041' and level2 is null and level3 is null and level4 is null) OR (group_Id = 1 and role_Code = 'HSP' and level1 = '0041' and level2 = ... |
46. HQL Delete Query forum.hibernate.orgHi, Please help me in writing HQL delete query. My entity Class is like this public class FunctionResourcePermissionData implements java.io.Serializable { // Fields private FunctionResourcePermissionId id; private CompositeResourceData resourceObject; private FunctionData function; private String permissionCode; private Date recordCreationTimestamp; private String recordCreationUserId; private Date lastUpdateTimestamp; private String lastUpdateUserId; The Id class is public class FunctionResourcePermissionId implements java.io.Serializable { // Fields private Integer ... |
47. Delete using in clause forum.hibernate.orgI want to delete all the records from a table whose ID is present in a set of values. Can I do this using Criteria queries? For more clarity, I want to implement the following query. DELETE * FROM A WHERE ID IN (a, b, c, ...) I hav all the IN parameters in a Vector. Thanks |
48. Delete Query did not work on mysql4.0.12 forum.hibernate.orgHi , I am learning hibernate and tried to execute a delete query. The system said error in my query. Please help me on what I am doing wrong. I am using hibernate 3.1 JDK 1.3 Mysql 4.0 Error message : ERROR JDBCExceptionReporter:58 - Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check ... |
49. DELETE query forum.hibernate.org |
50. delete query in hibernate forum.hibernate.org |
51. Problem with Delete Query forum.hibernate.org |
52. Can the WHERE clause on an UPDATE/DELETE be modified? forum.hibernate.orgHello, Is there a way to update the WHERE clause in an update scenario without writing the HQL UPDATE or DELETE statement from scratch? For instance on a FIND you can pass in a criteria object which will affect the WHERE clause. Can this be done (maybe in a lifecycle event like preUpdate, prePersist), can the HQL be modified in any ... |
53. hibernate delete query must begin with SELECT or FROM? forum.hibernate.orgI am migrating our app from 2.x to 3.2.5 and face problem with delete queries. I am following the migration guide and using session.createQuery(deleteQuery).updateUpdate(), but the createQuery() throws an exception that the query must start with a SELECT or FROM. At the simplest, I am trying to do a delete with no where clause expecting all to be deleted, using something ... |
54. query only (no updates) triggers delete and then insert forum.hibernate.org |
55. Set of UserTypes: delete with bad param count to nullSafeSet forum.hibernate.orgAuthor Message cheesus Post subject: Set of UserTypes: delete with bad param count to nullSafeSet Posted: Fri Feb 22, 2008 11:01 am Newbie Joined: Tue Aug 28, 2007 12:54 pm Posts: 13 Location: Munich, Germany Hi all, I have a Set of (Composite)UserTypes that work well for reading and writing (insert), calling nullSafeSet with an insert containing three parameter ... |
56. Refresh after 1-to-m related item is deleted from db forum.hibernate.orgHibernate version: Hibernate 3.2.6, annotations 3.3.1 and entitymanager 3.3.2 L2 Caching disabled Name and version of the database you are using: Postgres 8.2 I have two entities: Parent and child, with parent.children as a OneToMany relationship to child. A parent and all its children are read by one EntityManager and transaction (EM1). FWIW, no changes are made to the parent or ... |
57. Hibernate Named Query for insert ,update and delete forum.hibernate.orgI am able to call the named query for select of native and object queries using |
58. DELETE sql query forum.hibernate.orgHi I'm new to hibernate and i have a problem with DELETE SQL query for Oracle which all request going through hibernate.Previously who developed the systems has already left the company. Hence we dont have any related documentations as well. When i went through the source , i have found only a select query. where would be the delete query located ... |