1. Hibernate - saveOrUpdate = insert or update? coderanch.comIt will INSERT or UPDATE depending on the value of the objects identifier (PK if you will). If your transient object has an identifier value, then update() is called, if it doesn't save() is called (which generates an identifier). So your new object should be inserted, unless you have already assigned an identifier which isn't in the DB, in which case ... |
2. saveOrUpdate always inserts forum.hibernate.orgOkay here;s some context AddressForm userInputAddres = (AddressForm) form; List addressList = customer.getAddresses(); Address address = new Address(); BeanUtils.copyProperties(address, userInputAddress); if(!addressList.contains(address)) { AddressUtil.save(address); } ..then in my Util class session.saveOrUpdate(address); So when I haven't an id does hibernate have no means of comparing all the other fields to work out whether to save or update .. after all the method is ... |
3. session.saveorUpdate(this) does a DELETE followed by INSERT! forum.hibernate.orgI am calling Partner.storeProfile(). OfflinePartnerProfile is an ASSOC table between Partner and TransmissionProfile. It has no P.keys but only 2 Foreign Keys (partnerID pointing to Partner table) (profileID pointing to TransmissionProfile table) So OfflinePartnerProfile.java as a OfflinePartnerProfilePK (composite key) as the only attribute I cannot do a store on Partner directly (read only) so have to do a store on the ... |
4. When doing SaveorUpdate(), it does not insert in Database forum.hibernate.orgHi, I have a parent child relationship in which i want to save a new child in a parent. I have set unsaved-value attribute also in my set. Also have given cascade="save-update". My problem is , it fires an insert query on the console but does not save in the database. I have commited at the end of the transaction also. ... |
5. Cannot cascade insert when using saveOrUpdate() forum.hibernate.orgBeginner Joined: Wed Oct 12, 2005 8:52 am Posts: 23 Description: The situation is that i need to retrieve an object with all dependencies from one database and upload it into another database(which is empty). This example have one group consisting of many users. I have used two sessions which different config files to be able to connect to the databases. ... |
6. saveOrUpdate generating two insert statements forum.hibernate.org |
7. saveOrUpdate() issuing update instead of insert forum.hibernate.orgHi I am doing an upgrade of Hibernate from 2.1.8 to 3.3.1. While testing the upgrade, I am facing with a weird scenario. The application is creating a new hibernate object, and calling SessionImpl.saveOrUpdate(obj); to save that to the database. And it was working good in 2.1.8. But when the new jars for 3.3.1 are added, this method some how assumes ... |