1. In JPA, does rollback occur for the native queries? stackoverflow.comI'm using JPA 1.0 with hibernate as my provider. Inside an entitymanager transaction, if a series of native queries are run (which include DELETE sql statements) and an error occurs, will ... |
2. Do transactions collect queries to the database or lock it until a commit? stackoverflow.comAssume this snippet of Hiberante code:
My question is, does this work as expected? That is, can I read something from the database, set it ... |
3. Drools flow persistence - Named query not found: ProcessInstancesWaitingForEvent stackoverflow.comI have a problem with drools flow persistence (MySQL), I get the following exception:
|
4. Does Hibernate3 query require a transaction? coderanch.comOriginally posted by Andy Hahn: Is my following get method sufficient for querying with Hibernate3 or do I need to wrap it in a transaction and commit and close the session? I have seen it done both ways but I am looking for the proper way to do this. Thanks. public List getTraffic() { List list = null; try { Query ... |
5. When does the hibernate query commit? coderanch.comI use session.save(customer); My problem is that , Now my custonmer table has a child CUST_IDEN. The statement session.save(customer); does not throw any exception if there is a primary key violation in CUST_IDEN table. Instead the exception is thrown only later when i commit the transaction. Is this how it is supposed to happen? The CUSTOMER hbm file contains this entry ... |
6. Hibernate Queries and Transactions coderanch.comI've set up some Hibernate transactions and queries to select data from the database, update it, and then save the results back to the database. However, now I just want to get a list of some of the items in the database. I don't need to make any changes at all. So I don't need to commit or rollback. However, will ... |
7. Queries within a transaction cause an update forum.hibernate.orgI'm seeing some behavior with Hibernate I did not expect. Basically, I load an entity instance from the database, apply some changes to the fields, start a transaction, then run a (select) query; at this point the changes to the entity are being run against the database. I know this because I get a constraint violation (which I was trying to ... |
8. Queries within a transaction cause an update forum.hibernate.orgI'm seeing some behavior with Hibernate I did not expect. Basically, I load an entity instance from the database, apply some changes to the fields, start a transaction, then run a (select) query; at this point the changes to the entity are being run against the database. I know this because I get a constraint violation (which I was trying to ... |
9. Mulitple queries:Session/transaction? forum.hibernate.orgApologies if it sounds too trivial but I am facing some in querying database. I am doing some data insertions in DB in 4-5 steps and then based on further computation I am trying to update the status of data inserted in above steps and at that time it is taking too much time/being idle(thread in stepping state). Same status update ... |
10. Basic question about list queries and transactions forum.hibernate.orgHi All, I'm going through the initial tutorial, why is it that the listEvents function below needs to wrap the list function in a transaction? I would've thought we could do a read only query without needing a transaction? From tutorial: private List listEvents() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); List result = session.createQuery("from Event").list(); session.getTransaction().commit(); return result; } |
11. Query commits transaction forum.hibernate.org[Controlese] 15:56:35 DEBUG DataSourceTransactionManager:371 - Creating new transaction with.... [Controlese] 15:56:35 DEBUG DataSourceTransactionManager:202 - Acquired Connection [jdbc:postgresql:.... [Controlese] 15:56:35 DEBUG DataSourceUtils:170 - Changing isolation level of JDBC Connection .... [Controlese] 15:56:35 DEBUG DataSourceTransactionManager:219 - Switching JDBC Connection to manual commit [Controlese] 15:56:35 DEBUG RoleHierarchyImpl:107 - getReachableGrantedAuthorities() - .... [Controlese] 15:56:49 DEBUG DataSourceTransactionManager:469 - Participating in existing transaction [Controlese] 15:56:49 DEBUG RoleHierarchyImpl:107 ... |
12. What happens with Queries executed without transaction? forum.hibernate.orgHi, I am currently maintaining an application, which does hibernate queries without an active (manually managed) transaction, only for data modifications it creates a transaction. This seems to work well, however I remember somewhere I've read that hibernate always requires a transaction. What are the implications of ignoring this rule? It seems for this case the postgresql driver (or hibernate?) opens ... |
13. Insert Query run only in unchained transaction forum.hibernate.orgHello, I have a problem with a transaction and particularly the transaction mode when i open a transaction with those instructions to make an insert operation session = sessionFactory.openSession(); transaction = session.beginTransaction(); I have this message about the transaction mode which said we should be in an unchained transaction mode. What can i do with the connection to resolve this kind ... |
14. Why Hibernate Transaction in a query ? forum.hibernate.orgThe reason you need a transaction when querying is that if you do multiple queries, you want to be querying consistent data. You wouldn't want the data changing underneath you from query to query. Using a transaction ensures that a set of related queries will be querying consistent data. I think my role on these forums is to provide more straightforward ... |
15. rollback on queries forum.hibernate.org |
16. Query without transaction ? forum.hibernate.orgBut if you don't have anything to commit/rollback, why even have a transaction. The 4 methods in Transaction are commit(), rollback(), wasCommitted() and wasRolledBack(). If you don't need to do any of these, why create a transaction. If you call transaction.commit() for a SELECT statement, don't you end up opening yourself up to the possibility of updating data by some fluke ... |
17. Queries and Transactions forum.hibernate.org |
18. Query flushe's but does not commit in DB forum.hibernate.orgtry { Session sess = HibernateContext.getTemporarySession(); processInventoryDestinationCheck(sess, (Shipment) entity); sess.flush(); sess.close(); ... |
19. why use transaction when doing query with hibernate ? forum.hibernate.orgas transaction is used when we failed commited sth, the transaction will do the rollback action to protect data. but when doing query in DB, we don't need anything rollback, so why hibernate still using transaction in this case? is it will influence the performance? I get puzzled. thank you for anyone's help! : ) linna. |
20. Don't deference exception from query within transaction forum.hibernate.orgNewbie Joined: Fri Jul 01, 2005 9:38 am Posts: 4 Location: Ohio, USA I am having a problem with a self-referencing table and the all-delete-orphan option for a one-to-many list. If I do any kind of query against this object (other actions also generate the error) within the scope of a transaction, I get the infamous "Don't dereference..." exception. After spending ... |
21. Optimistic Locking with Custom Query forum.hibernate.orgHibernate 3.1.3 Annotations 3.1 Beta 9 I am trying to update an object with a custom where clause so that proper optimistic locking can be done. Is that possible? I could not find anything in the session API to allow me to update an object and at the same time specifying a custom where clause. Also, on a related object, how ... |
22. Query cache lock contention forum.hibernate.org |
23. hibernate query reagrding transactions and session forum.hibernate.orgThanks for the prompt reply but what I wanted to ask was that just using session.save would do that or do I have to use session.beginTransaction() method. I agree with what you said that the values are inserted but not commited when we do session.save(order) but if there is any error then Hibernate would do that on its own or do ... |
24. Why wrap Queries in transactions? forum.hibernate.orgThanks for the reply and clarification. This was inadequately addressed in the first edition books I've read. I assume you are plugging the new edition because you clarified this in print. on the page you cited: ... in fact, every SQL statement, be it queries or DML, has to execute inside a database transaction. There can be no communication with a ... |
25. Query is causing an extraneous UPDATE on commit. forum.hibernate.orgI'm running into the problem described here, http://forum.springframework.org/showthread.php?t=9702 . And indeed, their session.clear() suggestion does work around the issue. Why is this occuring though? Logging indicates this is the first time the session is opened (I use the HibernateService defined in the Hibernate in Action book). Nothing could have "dirtied" the objects at this point. Why is my query causing it ... |
26. Hibernate concurrently executes the same query forum.hibernate.orgI'm using Hibernate 3, with EHCache 1.1. I have a server running in JBoss, which relies on Hibernate for ORM and data querying. My server serves requests from many client applications. In some instances they all ask from the same data. I've enabled Hibernate to cache data using the combination of query cache and EHCache. When my server sends a query ... |
27. Differences between session.lock and query.setLockMode. forum.hibernate.orgpublic List findUnique(String query, Object[] params, String lockAlias) { Session session = (Session) transManag.getPersistenceSession(); String queryValue = queryProperties.getProperty(query); Type[] types = TypeConverter.convertTypes(params); Query hibernateQuery = session.createQuery(queryValue); hibernateQuery.setParameters(params, types); hibernateQuery.setMaxResults(1); return hibernateQuery.setLockMode(lockAlias, LockMode.WRITE).list(); } |
28. Why sometimes the Transaction is required for Query forum.hibernate.orgWhy sometimes the transaction is required for query, sometimes the transaction is not required? Where and what is the logic for that? In my opinion the transaction is not required for any query, but today I use Oracle 10g where was impossible to make Query without transaction: public static List |
29. Queries very slow in a transaction forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.2.1.GA Mapping documents: Code: |
30. Query after exception in transaction? forum.hibernate.orgHibernate version: 3.1 Mapping documents: Code: |
31. Do you really need transaction forsimple query? forum.hibernate.orgI have noticed in many examples that the user begins and closes a transaction when all there is in the operation is a simple query. Can some one explain why the transaction is established. Is there any benefit in not creating a transaction? Example code to illustrate: Code: Session session = HibernateUtil.getSessionFactory().openSession(); ... |
32. Query about Hibernate Transaction Semantics forum.hibernate.org |
33. How do I request a lock on a query? forum.hibernate.orgI am trying to automatically assign account numbers in an accounting system by finding the highest account number in a given range and then adding one to it. Basically, select max(number) from account where number >= :min and number <= :max and business = :business. However, what I've noticed is that two accounts added simultaneously may get the same number. Obviously ... |
34. Error making rollback after an persist and query forum.hibernate.org |
35. queries within the same transaction forum.hibernate.orgI think I know what happens. Like I load the A element within a transaction, when I modify it adding B elements, Hibernate returns the new state when I query the DB, because it does not read from DB but form A memory instance. So, effectively, what I need is to raise a SQL query via jdbc connection. Bye. |