row « Update « JPA Q&A





1. Updating Multiple Rows - Hibernate    stackoverflow.com

In my addresses table, I have an field named isPrimary. For each address assigned to a user, the user can only have one address as a primary. I have the method below ...

2. JPA updating multiple rows and tables    stackoverflow.com

i need to update multiple rows in Table a and it seems ok to use the object oriented approach by using a for loop and doing a merge.

...
// get list ...

3. instead of merging creats a new row.    forum.hibernate.org

I have an enity entityA which I extract from the database using a finder. I update enityA then put it back in the database calling entityA.merge() instead of entity.persist() Is this correct so far. If so at least I am on the right tack on how to update a persisted enity. But enityA also has a relationship with another enity enityB ...

4. Updating more than one row    forum.hibernate.org

6. many-to-one adds new row on update    forum.hibernate.org

7. Update table if no row exists    forum.hibernate.org

Newbie Joined: Wed Jul 28, 2010 3:31 pm Posts: 6 Hello, I tried looking for an answer to the question I have but I wasn't able to find a straight forward answer anywhere. Need a description? I have a table that has the following columns: Dept_Name, Dept_ID, Date_Tmst, Amount. This table has a composite primary key - Dept_Name, Dept_ID, Date_Tmst. There's ...

8. save update create new row in table    forum.hibernate.org

Hi i have hibernate mapping like this class name="com.example.Company" table="user"> Code: ...

9. "Row was updated ... by another trx" due to custom type ?    forum.hibernate.org

Newbie Joined: Mon May 02, 2011 10:46 am Posts: 9 Hi, (Hibernate 3.3.1 on Oracle 10g) 1/ I have a table CONTACT_INFO with column ADDITIONAL_EMAIL that will contain email addresses separated by semi-colons; 2/ the pojo to which this table will be mapped has the following set- getters: {code} public class ContactInfo {... public java.lang.String[] getAdditionalEMail() { int size = _additionalEMailList.size(); ...





10. .saveOrUpdate() and .merge() always created a new row    forum.hibernate.org

Hello! I have a table/entity where the date column is unique. equals() and hash() methods always check for the not-null date. However, when I want to overwrite data for an existing date, Hibernate tried to add a new row which fails due to the unique constrain on the column. What's the most common approach to Update a row for an existing ...

11. saveOrUpdate does not save new objects/rows    forum.hibernate.org

I'm writing a web application and am unable to get Hibernate to save new rows when using saveOrUpdate(). Existing records are updated as expected. Here is the important part of my config file: integer ... And here is the code to save/update an object of this type: ...

12. OpenSessionInView updating rows problem    forum.hibernate.org

I am using an Spring and hibernate architecture for my web application. It seems that if using OpenSessionInView , at editing , the data is not updated into the table (at least is not comited). The same code is working correct from the unittests. my transaction proxy looks like this:

13. Only part of Row being saved to DB    forum.hibernate.org

Hi all, I am trying to save an object to the database. I print out the object before trying to save it and all the information is displayed. But, after inserting it into the database the only field that gets saved is the id that gets created when adding the record. So, I have an empty record that has just an ...

14. How can I prevent saving the duplicate rows.    forum.hibernate.org

Hi , I'm facing a problem when trying to save the persistent class and it's inserting the duplicate rows after generating the primary key. I don't have primary key with the object , that I can load and comapre with the existing so implementing the equals and hashcode method is ruled out. In the code I'm trying to get the record ...

15. How to update a row in hibernate    forum.hibernate.org

16. Cannot update rows in database    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hi, I'm trying to update a specific row in my table, but I got the following error from Jonas console: Can anyone please help me. Thanks in advance [b]Hibernate version: 3.0 [/b] [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close(): session = HibernateUtil.currentSession(); tx = session.beginTransaction(); String sql = "FROM GlopUserType u WHERE u.jobTitle ...





17. best way to update multiple rows in db    forum.hibernate.org

Hi, I have read few post in the forum related to this issue, but I still have some questions. I know very well that Hibernate is orm so it's not designed to run updates on multiple rows. but there is a situation when it can be useful. sometimes I need to change a flag on several rows, not 10,20 but 500 ...

18. Expiring and creating a row instead of updating it...    forum.hibernate.org

I was wondering if there is a way to let Hibernate know that when any of my mapped objects change state, that it should expire the old db row and create a new one rather than updating the current row. In our database model we never use updates on any of the tables, but instead, we create a new row with ...

19. Replacing the previously saved row    forum.hibernate.org

20. updating a row in the database    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Full stack trace of any exception that occurs: 08/03/2006 14:23:57 org.hibernate.event.def.AbstractFlushingEventListener performExecutions SEVERE: Could not synchronize database state with session org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.taldor.ko.datamodel.vo.Site#916] at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1441) at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1986) at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909) at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at ...

21. Updating rows through a cursor in Hibernate    forum.hibernate.org

Hi All, I'm currently using the following pattern in my JDBC code: Code: Connection conn = obtain a DB connection; String sql = "some complicated SQL query"; PreparedStatement s = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery(); while(rs.next()) { String foo = rs.getString("foo"); Integer bar = rs.getInt("bar"); Boolean baz = rs.getBoolean("baz"); // Complicated ...

22. Problem Updating a row!!    forum.hibernate.org

Hi, Im getting weird error. I have a many-to-one relationship(unidirectional) between two classes(say A-B). Now when I try to retrieve records from the many side I can retrieve the records with no problem. One more thing to be mentioned here is that its 1-0 relationship. that means, for a particular row in A there might be 0 or 1 row in ...

23. How to update a single row?    forum.hibernate.org

Hibernate version: 3.0.5 I plan to use a table to create a queue of work from which multiple threads can retrieve units, but I only want each thread to retrieve a single unit of work at a time. Also, I'd like to avoid collisions between threads looking for a new unit of work. So, the plan is to have a "lock" ...

24. Persisted object shows up in multiple database rows    forum.hibernate.org

I have two entityclasses (person and organization) that I use to track groups of individuals. These are mapped to each other using a many-to-many relationship with organization being the "owning" side. When I create a "person" and add it to multiple organizations then persist each organization (using entitymanager.merge(organizationobject), the same person is represented in multiple rows in the database (each with ...

25. Why all rows are updated without any change?    forum.hibernate.org

Newbie Joined: Mon Oct 16, 2006 2:34 am Posts: 4 Thanks fo the hint. In fact it was a nullable primitive issue. I solved it by creating a NullableIntType, but made a mistake in there. Now, by using java.lang.Integer rather than int I could solve it much smoother. I post the Type just for completeness. Maybe someone can help me with ...