1. How can you replicate Hibernate's saveOrUpdate in JPA? stackoverflow.comIn JPA, is there any way you can replicate Hibernate's saveOrUpdate behavior,
|
2. Best practice to return a result Flag after saveOrUpdate in hibernate? stackoverflow.comOften we have to use some of the methods which don't return anything useful. If I invoke saveOrUpdate() in hibernate , I don't know whether it has been performed successfully . ... |
3. Problem with saveOrUpdate() stackoverflow.comI've problem with Hibernate. I have a class User
where id is native generator in User.hbm.xml , and name is primary-key in DB.
In ... |
4. Understanding Hibernate saveOrUpdate and the Persistence Life Cycle stackoverflow.comLet's look at a simple example of a dog and a cat that are friends. This isn't a rare occurrence. It also has the benefit of being much more ... |
5. Hibernate saveOrUpdate behavior stackoverflow.comDoes anyone know how Hibernate knows whether to INSERT or to UPDATE a value in the database when |
6. SaveOrUpdate API - Hibernate BUG? coderanch.comNo, not a Hibernate bug. If you want to find out if something is a bug in Hibernate, they have a JIRA Issue tracking site you can use. When you call saveOrUpdate you will either update an existing record or insert a new one based on how Hibernate checks unsaved values - normally, whether or not the id been changed, or ... |
7. hibernate _ saveorUpdate problem coderanch.com |
8. Hibernate - SaveorUpdate coderanch.com |
9. Hibernate SaveOrUpdate coderanch.comHello, I am new to Hibernate and facing very basic problem and not able to found what's issue in the code ...... I am updating an Employee data using the hibernateTemplate.saveOrupdate method ....but when i m calling get or load method its failing saying no row found .. I am pasting my Code below .. public static void main(String[] args) { ... |
10. Hibernate saveOrUpdate Not Working forum.hibernate.orgWhy do you think Hibernate didn't perform an update? Update_Time and Update_User are changed. Create_Time and Create_User as well => they are set to null. The only thing that seems a little confusing is that the rolename is unchanged. Maybe you didn't show the complete code. Do you think Hibernate has to show the statement in it' logs? Then you have ... |
11. can not saveorupdate please help forum.hibernate.orgAuthor Message supratim Post subject: can not saveorupdate please help Posted: Thu Feb 18, 2010 8:48 am Newbie Joined: Thu Feb 18, 2010 8:35 am Posts: 3 Hi all, I have this following mapping files. Author.hbm.xml Code: [color=#000000] |
12. saveOrUpdate forum.hibernate.orgHi, I have very strange problem using saveOrUpdate. Basically I am trying to save transient object to DB and operation seems to go through fine (I get back an id), but when I check the DB nothing appears in the table. Now to make things even more strange when I try to insert some dummy manually I can do it, and ... |
13. SaveOrUpdate not updating forum.hibernate.orgHello, I've got a problem with saveOrUpdate not saving anything, and the logs aren't telling me much. I'm using annotations for my entitiies, with a GenerationType of IDENTITY, but I've also tried SEQUENCE and I still don't get any updates. I can create the objects, but when I load one, change a property and call saveOrUpdate I can't see any update ... |
14. saveOrUpdate forum.hibernate.orgHow come saveOrUpdate does not work for the save part but does work for the update? If I use: session.saveOrUpdate(item); it does not work for a save but does for an update. If I change to: session.save(item); the save is done correctly. The message says something about the number of updates(0) does not match the expected number of updates(1) or something ... |
15. one-to-one saveOrUpdate problem forum.hibernate.orgHello, My setup is JBoss 3.2.1, with Hibernate 2.03 installed as an MBean running against MS SQLServer 8. All Hibernate calls are actioned through Session EJBs with CMT, the Hibernate session being closed at the end of each EJB method invocation. We've got a one-to-one relationship set up as follows: Code: default-cascade="none" |
16. save and saveOrUpdate problem forum.hibernate.orgYes, several solutions : - business rules allow you to know if it's a new object, then explicitly call save() or update() : not that good. - business rules allow you to know if it's a new object, thus implement it in an interceptor isUnsaved(). Have a look at section 9.4 - use version or timestamp in your object, thus you ... |
17. Trouble w/ saveOrUpdate() forum.hibernate.org/** * @hibernate.id * generator-class="native" * column="id" */ public Long getId() { return _id; } public void setId(Long id) { ... |
18. saveOrUpdate to database forum.hibernate.orgHere I'm back with the same question: I have the following situation: c1 has 2 children c2 and c3 c2 has also 2 children c4 and c5. when I store c1 into the database, everything works fine. when I load c1 back from the database, remove c4 and store c1 into the database again, c4 is not removed from the database. ... |
19. saveOrUpdate bug fix available? forum.hibernate.org |
20. saveOrUpdate problem forum.hibernate.orgBeginner Joined: Tue Nov 09, 2004 12:22 pm Posts: 44 I'm experiencing a problem with this method. The query should be UPDATE but the query used is the INSERT. I've read the FAQ and the reference guide but I still do not understand. The id of the table is a native key and when the users are loaded the have their ... |
21. saveOrUpdate problem forum.hibernate.org2.1.4 |
22. Unable to persist object with one saveOrUpdate() call forum.hibernate.orgHibernate version: 2.1 Mapping documents: Parent.hbm.xml: |
23. saveorupdate vs save forum.hibernate.orgwhat is the difference between session.saveorupdate() and sesssion.save(). when to use saveorupdate ? I tried to insert a row with saveOrUpdate but it gave me Could not synchronize database state with session , SQL insert, update or delete failed (row not found) error. when i changed it to session.save() it worked. can someone tell the difference ? here is my hbm.xml ... |
24. saveOrUpdate can't save a new object? why? forum.hibernate.orgsaveOrUpdate can save a new Object, but saveOrUpdate can't save a new object? why? public void testSaveOrUpdate() { PigeonholeType pigeonholeType = new PigeonholeType(); pigeonholeType.setSymbol("none"); PigeonholeRule pigeonholeRule = new PigeonholeRule(); pigeonholeRule.setXtypeSymbol("SB006"); pigeonholeRule.setSize(new Integer(0)); pigeonholeRule.setPigeonholeType(pigeonholeType); pigeonholeRuleDao.saveOrUpdate(pigeonholeRule); } public Serializable saveOrUpdate(PigeonholeRule obj) throws HibernateException { session = sessionFactory.openSession(); x = session.beginTransaction(); session.saveOrUpdateCopy(obj); tx.commit(); } [WARN ] [2005-03-14 11:28:01,750] net.sf.ehcache.config.Configurator - No configuration found. Configuring ... |
25. why is saveOrUpdate writing to db when there is no change? forum.hibernate.orgBeginner Joined: Mon Nov 15, 2004 8:32 pm Posts: 36 Hi, We hit some database performance problem in one of our test environment. Turning on hibernate sql logging, I noticed there are lot of "update" statements going on even though there is no changes in our POJO. Here is a stripped down version of the problem. Notice between the "before store" ... |
26. manual saveOrUpdate, emergent help needed forum.hibernate.orgI need to implement manual saveOrUpdate method, (Object's id's are semantic keys that hibernate generates, but all they have a business key) pseudocode is saveOrUpdate(Object o) { find according to business key if exists assign o to the object in the database and update object in the database else save } but for many-to-one relations, I got "Object references to unsaved ... |
27. How to retry saveOrUpdate after PropertyValueException? forum.hibernate.orgAuthor Message johan1 Post subject: How to retry saveOrUpdate after PropertyValueException? Posted: Mon May 16, 2005 7:09 am Beginner Joined: Mon May 16, 2005 6:06 am Posts: 20 Hi, what is the right way to retry saving a new/transient object where saving failed before because of a not-null constraint on one of it's properties? When I simply set the ... |
28. Meaning less Save and SaveorUpdate forum.hibernate.org |
29. Object saveOrUpdate(Object) forum.hibernate.org |
30. behavior of saveOrUpdate() forum.hibernate.orgFirst of all, yes.. I read the documentation. But I'm confused. So, I'll blow a credit and get you folks to explain it to me :-) My original understanding: - Load persistent object in business tier, pass it to UI via RMI - UI modifies object and passes it back via RMI (EJB call) - EJB method calls session.saveOrUpdate(detachedObject) and... - ... |
31. saveOrUpdate() can't save and can't update forum.hibernate.orgHi, Having a superclass Employee and a subclass ContentProducer mapped through the "table per subclass" mapping strategy, I cast an Employee instance to a ContentProducer and tried to save the resulting object using the saveOrUpdate method(), but with no success. What happened, I guess, is that at first Hibernate was unable to save the ContentProducer because of the existing Employee with ... |
32. SaveOrUpdate forum.hibernate.org |
33. Save or SaveOrUpdate the same behaviour? forum.hibernate.orgHi everyone! Yesterday, I tested my DAO layer with a simply Pojo and I got surprised that a save and saveOrUpdate have the same behaviour. Here is my unit test: |
34. saveOrUpdate() forum.hibernate.orgI think that it's for use with the DOM model, rather than the POJO one. The object you pass in is always going to be the same class (Element, I think), so you use the entity name to discriminate. There's no need to use any of the methods with entityName parameters if you're working with a pure POJO model. |
35. return code of saveorupdate forum.hibernate.org |
36. saveORUpdate forum.hibernate.orgHi, I have learnt that Hibernate uses "unsaved-value" property of "id" element to determine wether to insert or update a row. How can we make Hibernate use a different attribute rather than id to determine wether to insert or update a row. For example my data class is public Customer { private String custRef = ""; private String saveMode= ""; private ... |
37. SaveOrUpdate and Contains forum.hibernate.orgI want the following functionality 1. I need to 'load' an object (let's say a person object with name Jack) in the session an object for validation 2. Need to 'saveOrUpdate' it later It throws NonUniqueObjectException. To avoid this I tried the following 1. first use currentsession.contains(thisinstance). If false, use saveOrUpdate. true, do nothing - it didnt work. contains returns False ... |
38. Hibernate saveOrUpdate not actually updating the DB forum.hibernate.orgI'm having some wierd behavior in which saveOrUpdate does not actually save my changes back to the database and no exceptions are thrown. Im not sure what exactly is going on. Here is my Hibernate Mapping file for the Object in question: |
39. Problems with SaveOrUpdate forum.hibernate.orgHello everybody, I have a question about the saving and/or updating mechanism of hibernate. In my application I have a lot of tables which are all mapped bidirectional. In most cases I have a |
40. iterate and saveorUpdate forum.hibernate.orgHi, I need to ieterate 2 lists and save to database. But I could only save the first value coming and next ones not saving into the database. Here is my code : Code: List works; WorkBasedQuote wqt = new WorkBasedQuote(); WorkBasedId workBasedId; ... |
41. Problem with saveOrUpdate forum.hibernate.orgI'm trying to insert in one table with saveOrUpdate. I created a new object and I'm using the assigned generator. Hibernate is executing update and not insert. What is wrong? The code is the follow: HBM file: |
42. save() or saveOrUpdate() forum.hibernate.orgOK, here goes. Code: |
43. makePersistent=saveOrUpdate, but what about save and Update forum.hibernate.orgThe In Action Hibernate book folks offer us examples of classes with the method names of makePersistent which will call the HibernateUtil.getSession().saveOrUpdate. But sometimes you only are interested in saving data. If the data already exists you need to throw an error. Therefore you are obligated to call HibernateUtil.getSession().save Other times you only want to Update. If the data doesnt exist ... |
44. Changing Behavior of saveOrUpdate forum.hibernate.orgHello, I have a table with a generated Id (mapped as Id in Hibernate) and a logical Key (a normal property with a unique index in database). If I use saveOrUpdate, it looks for the Id, and if its not in table, it uses save to save the object. So it can happen, that it tries to generate a new row, ... |
45. SaveOrUpdate API forum.hibernate.org |
46. SaveOrUpdate API - Hibernate BUG? forum.hibernate.org |
47. Problem using saveOrUpdate forum.hibernate.orgI am trying to understand how HibernateTemplate handles session open and close. I was using saveOrUpdate to persist objects and I came across the well known "org.hibernate.NonUniqueObjectException". Then I started using merge() to overcome this problem. But now I am curious to know what exactly was causing this error since I do not see how a second instance of the same ... |
48. saveOrUpdate only if necessary forum.hibernate.org |
49. How to handle UniqueConstraintException after saveOrUpdate forum.hibernate.org |
50. StringIndexOutofBounds on SaveOrUpdate forum.hibernate.orgBeginner Joined: Fri May 16, 2008 3:59 pm Posts: 30 Hi Im parsing text files then using hibernate to store them to mysql. Eveytime I call saveOrUpdate on my FinancialAccount object, I get: Exception in thread "main" java.lang.StringIndexOutOfBoundsException with no details like a -1 or 6 to tell me where. I am doing much subString(start, end), but shouldn't the exception take ... |
51. Newbie Mistake using saveOrUpdate? forum.hibernate.orgHi All, I think I am making a standard rookie Hibernate mistake when trying to update some database information. Based on this assumption, I have left out the implementation details but can provide them if needed. Problem Scenario: Class A has a list of Class B, using a typical bi-directional mapping. Class B has a list of Class C, also using ... |
52. SaveOrUpdate behavior forum.hibernate.orgHi, in my application I have mapped an association (many to many) between the entities "content" and "document". Now I'd like to implement the concept of "priority" in showing the documents associated with a content in the order I decide in my CMS. I succeed in passing to the controller the doc ids in the order I want, but when the ... |
53. SaveorUpdate syncronisation forum.hibernate.orgHello , i am currently working with hibernate3.3 in our code we load the session obj from the config (no spring support) ... and keep this in the ThreadLocal. Our app is a multiThreaded application . On a request we create a new thread and call saveorupdate by getting the session from the threadlocal .... i am currently getting a DUPLICATE_KEY ... |
54. Should I call saveOrUpdate within a **Ignore*** forum.hibernate.org |
55. Should I call saveOrUpdate within a container mng transact? forum.hibernate.orgI have an interesting problem that I discovered when deleting an object and then calling saveOrUpdate on it. I started to get exception "Found two representations of same collection." I did some digging around and found a jira issue was open some time back to fix this problem. Most people who had this problem were getting it for different reasons than ... |
56. Problem with saveOrUpdate forum.hibernate.orgHi, I'm implementing export and import functionality in my application. First the user will export all the data from database to the excel sheet and then he'll add (or) update any row or column in the excel sheet. For this I'm using saveOrUpdate method of Hibernate. But I'm getting error "Duplicate entry for Tag_Number (ofcourse its unique)". But I think this ... |
57. whether saveorupdate (or) update should be used forum.hibernate.org |