sql « Update « JPA Q&A





1. How to execute an update via SQLQuery in Hibernate    stackoverflow.com

I need to update a joined sub-class. Since Hibernate doesn't allow to update joined sub-classes in hql or named-query I want to do it via SQL. I also can't use a ...

2. JPA merging two or more tables into another table    stackoverflow.com

Is it possible to take some columns from some tables(entities) and store them to another table's columns with JPA, Hibernate? For example;
Table1 : id, name, surname, ...
Table2 : id, school, city, ...

3. Hibernate Idempotent Update    stackoverflow.com

I tried searching this over the net but in vain. Is there a way to use hibernate to perform an idempotent update. One use case is to use HTTP PUT to ...

4. hibernate Update in natif SQL    coderanch.com

5. dirty checking and SQL UPDATE behaviour    forum.hibernate.org

Hi, is it possible in Hibernate that the automatic dirty checking on entities actually performs an update only on the properties I have changed for real? for example: //open transaction, get an entity "Person" person.setName("name"); person.setSurname("name"); //commit transaction performs an UPDATE statement like "update PERSON set NAME=?, SURNAME=? WHERE...", that updates only the properties I have changed for real and not ...

6. Utilising JPA with non SQL persistence    forum.hibernate.org

Hi all, We're moving from an existing C# application on SQL server to a Java and Spring service tier with the Cassandra storage back end. I haven't used Hibernate in java in a production environment since version 3 was released, however I have played around with the JPA on some small projects. Is it possible to use a minimal Hibernate configuration ...

7. win 2008 64 bit, SQL 2008, Updates with NHib don't work.    forum.hibernate.org

We recently moved our nhib appliaction from SQL 2005 and Win 2003 32 bit to Win 2008 64 bit and SQL 2008. There is something really weird happening. All of the update statements are not working. The inserts work fine but the updates don't. It doesn't even look like SQL is being generated to SQL Server. We know this is probably ...

8. Need help with sql-update    forum.hibernate.org

After reviewing the documentation, I cannot see how to use sql-update in a realistic case. Given: public class Person { private Long id; // identifier private String name; private String address; private Date phone; private Person bestfriend; ... } and hibernate-mapping ...

9. sql update and table names    forum.hibernate.org

Is there a way, programatically, to find the table name for a given class? For example, what table is the com.mine.Bob class mapped to? I am trying to do an sql update. I know that the table name is in the mapping file, but I would like to be able to change it in the future without having to remember to ...





10. Ms-Sql SCOPE_IDENTITY error when update to 2.1.2    forum.hibernate.org

Hello, I'm using MS-Sql 7.0 with jTDS 0.6 rc1. Ok, I know that this is a not supported configuration but I get this error when update to 2.1.2 version, with hibernate 2.1.1 every works fine. When I try to insert a new currency I get the following exception: Code: java.sql.SQLException: 'SCOPE_IDENTITY' is not a recognized function name. ...

11. Couldn't solve the problem, anyone help me! SQL update or...    forum.hibernate.org

Author Message littlescorpian Post subject: Couldn't solve the problem, anyone help me! SQL update or... Posted: Fri Mar 05, 2004 5:00 am Newbie Joined: Mon Feb 16, 2004 3:03 am Posts: 7 I have a small program, which try to update an informix database based on given parameters. First I delete the original records from db, then insert the ...

12. Custom SQL while saving    forum.hibernate.org

Hi all, is there a way to associate custom SQL to an object column while saving? What I want is this? I have a class with a composite key being: - parentId - sequence the sequence should be generated upon insertion and for each parentId, using something like "COALESCE(MAX(sequence), 0) + 1" (this is the easiest way). The other choice is ...

13. Custom SQL on Update    forum.hibernate.org

...

14. Why does many-to-one attr causes an additional SQL Update?    forum.hibernate.org

I am very new to Hibernate and trying to understand how it works. I am not sure of the semantics of many-to-one association. Any help would be appreciated. I have used the exmaple Cat class in the reference doc and written a sampe app. O-R Mapping is below Code: ...

15. I want to only save outputed sql. How do I?    forum.hibernate.org

16. aession.save produce too many sql updates    forum.hibernate.org

Newbie Joined: Tue Apr 06, 2004 9:15 am Posts: 4 Hibernate version: 2.1.6 ( the same one integrated in Jboss AS 4.0.1sp1 ) Mapping documents: Mapping use composite keys (id x beginDateTime x versionBegin ) ( Note: versionBegin isn't hibernate version) Name and version of the database you are using: Oracle 9i Hi, I have the following code: Code: ...





17. Custom SQL Update    forum.hibernate.org

I've been reading through the forums, but didn't find anything related to the issue I would like to discuss... In my application, which uses Hibernate 2.1.7, there are several ocassions where I need to save only the subset of a class. For example, imagine I have a User class, where apart from the usual data as name, address, etc., I have ...

18. Excessive amount of SQL updates created by Hivernate?    forum.hibernate.org

I have a ( what I consider normal ) biderctional one-to-many / many-to-one mapping between a Contact and Referral table (see below). The Contact has a Set of Referrals. The Contact is used in the UI of a web application. The Contact may be updated. In the service/dao layer a saveOrUpdate is performed on the Contact. The generated sql seem to ...

19. Hibernate doesn't do the SQL update during the save()    forum.hibernate.org

Newbie Joined: Thu Aug 18, 2005 7:48 am Posts: 5 Location: Paris Hi, I'm trying to update an object I've just loaded from database. I can get the object, display it, everything is good on this side, so mapping might be ok. But I can't save() the object in database... I got an Exception : Could not synchronize database state with ...

20. Using User Defined SQL Functions on fld while updating    forum.hibernate.org

Hi All, I have just started to work with Hibernate and I am using it with Spring MVC framework. My problem is that I need to use a user defined SQL function when updating the password. Now I have no idea how can I do this while using Hibernate version:3 aTaxPayerAccount = (TaxPayerAccount)this.getHibernateTemplate().get(TaxPayerAccount.class, user_id); aTaxPayerAccount.setPassword("dbo.EncMe("+password+")"); aTaxPayerAccount.setReset_flg("Y"); this.getHibernateTemplate().update(aTaxPayerAccount); Error stack trace of ...

21. SQL updates on just reads    forum.hibernate.org

Hibernate version: 3.1 Annotations 3.1 beta 6 Name and version of the database you are using: MySql 4.1.14-standard I have a two entities that share a one-to-many bi-directional relationship. When I do a simple find by ID on the entity on the many side, once my transaction commits I notice not only the select for the entity on the many side ...

22. why does hibernate cause an sql update?    forum.hibernate.org

1. when I add a child to the parent in a bi-directional relationship, hibernate does an sql update on the parent and updates the version even though nothing has changed in the parent row. How do I stop the update? Is it: optimistoc-lock="false" in the one-to-many children in parent mapping file? 2. when I do a session.merge(obj) this always causes an ...

23. need help in modifying static sql for update    forum.hibernate.org

Hi, would it be possible to add a custom "where clause" when we do a session.update(object)? I see that adding a native sql in the xml mapping require one to explicitly map parameters wich i dont want. I want hibernate to generate the update sql and append my where clause with it. Any help would be appreciated.

24. Custom sql function on save / update    forum.hibernate.org

thanks for quick reply, i've seen the interceptor on a link that u provided. yes it can modify the value of the property before the event, but the modification that i need is trying to use hql function for that property before the event, AFAIK it don't have any reference to do this ?

25. sql-update and parameters    forum.hibernate.org

Kartka karta = new Kartka(); karta.setImie("Krzysiek"); karta.setNazwisko("nowy"); karta.setNothing("jakastam"); ... ...

26. [Q&A] Update data for multi table in My SQL    forum.hibernate.org

I am using Hibernate to execute data. I have 2 table as bellow. TableA ( A1_Column, A2_Column, ) TableB ( A1_Column, B1_Column, ) I created sql query string as bellow: strQuery = "UPDATE TableA as A, TableB as B SET A.A2_Column = 'aaa', B.B1_Column = 'bbb' WHERE A.A1_Column = B.A1_Column" I executed query as bellow: Session sess = getSession(); Query query ...

27. SQL "for Update" implementation in Hibernate    forum.hibernate.org

Hi. This is my first query in this forum. Thanks in advance to all who helps me resolve my problem. The Problem: I want to implement sql for update in hibernate. I know that I can set the LockMode for Query or for a Criteria. To be specific, in normal JDBC I can do a "select ... for update" and I ...