save « Query « JPA Q&A





1. Why I need to explicitely save after a find with Hibernate?    stackoverflow.com

Why I need the line "session.save(user);" in the following code snippet? I thought, with the find call the user is already attached to the session and changes will be tracked and ...

2. Hibernate session.save with Update query    stackoverflow.com

i have a session.save() which performs the insert operations. and there is a condition that gives the number of rows updated if !=null. now i wanted to know how can i ...

3. My LinkedList is not saved as it should be (regarding its elements order)    stackoverflow.com

First of all, pardon me for my poor english level. I will try to be as understandable as I can. I am trying to re-order a playlist of music files. A Playlist ...

4. The order is not maintained while saving a collection    forum.hibernate.org

I have a collection(LinkedHashMap) which has a one-to-many relationship. While i save the parent object, the collection is getting updated to the database correctly, but hibernate is saving in a different order otherthan in the collection.I have to show the collection in the same order, the order which it is saved back to the client side. I don't have a column ...

5. The order is not maintained while saving a collection    forum.hibernate.org

I have a collection(LinkedHashMap) which has a one-to-many relationship. While i save the parent object, the collection is getting updated to the database correctly, but hibernate is saving in a different order otherthan in the collection.I have to show the collection in the same order, the order which it is saved back to the client side. I don't have a column ...

6. The order is not maintained while saving a collection    forum.hibernate.org

I have a collection(LinkedHashMap) which has a one-to-many relationship. While i save the parent object, the collection is getting updated to the database correctly, but hibernate is saving in a different order otherthan in the collection.I have to show the collection in the same order, the order which it is saved back to the client side. I don't have a column ...

7. Save before query    forum.hibernate.org

I have the following scenario: 1. The object X is loaded. 2. Same changes were made in object X. 3. I need to perform a query to validate the object X. 4. If the object X was valiad, then make persistent. The problem is that when I do the query, the object X is saved. How can I query without save ...

8. select before save    forum.hibernate.org

Hi. I want to insert many entities into my database via Hibernate. I use batch insertion but it seems to be too slow for my use case. When I debug the hibernate SQL I can see that it generates a SELECT statement for each session.save(...) call I use. I don't understand why? Is this the normal behaviour? My entity: Code: @Entity ...

9. HB 2.1.b3(b) and order of objects during save()    forum.hibernate.org

Hi, It appears that HB 2.1.b3(b) allows objects to be sent to the db in the same order as objects were sent to save(). Is there something that needs to be configured to achive this? Currently, the order apears to be random. Thanks P.S. The abobe assumption was based on the code of IdentityMap.java that now uses org.apache.commons.collections.SequencedHashMap.





10. order of save ??    forum.hibernate.org

Hellu again, Ok, we made some progress and now are able to do "some" saving of our order, however appearantly we have some problem in the order we create and fill our persist objects. Can some please give some insight in the correct order as I can't find it in the doc's neither faq/forums. What we have: - An Order object. ...

11. sorted collection index is not saved    forum.hibernate.org

Hey, I am trying to save a populated java.util.List. The list contains UserTransaction objects. I cannot use a Set because i want the objects order maintained. An UserSession has a one-to-many relationship with UserTransaction (the list with UserTransaction objects). Everything is saved ok except the collection's index : The "posn" column is created but no data is inserted in ...

12. Forcing save order    forum.hibernate.org

First of all, the IDs are all assigned and there are timestamps for versioning. I am working against a very heavily contrained Oracle DB with FK rules. Currently, I am getting a FK violation because Hibernate executes an insert on an object that aggregates another object (many-to-one) before the aggregated object is inserted. Does this make sense?

13. how can i do query in many to one?save me,thanks.    forum.hibernate.org

hi,every body,I have some trouble in query ,my mapping config is the text under ==========================================

14. Save or Update Query always updating    forum.hibernate.org

15. saving a criteria query?    forum.hibernate.org

i am new to hibernate. i have a use-case where i need to give the user the ability to create a query based on just about any property. the criteria query works like a charm. however, i also need to be able to save the query that is created for future execution (ie, the user uses a front-end to buid the ...

16. Force Hibernate to save a new instance of a queried object    forum.hibernate.org

Hi all, I'm using hibernate 2.1.6. I use it with PosgreSQL with the version 7.4.1.jdbc3 of the jdbc driver. I'm asking myself about the right method to use to save a new instance of an object already existing in the database. For instance : (myObject has got an id and a name property, and the necessary getters and setters, the id ...





17. Save me, for Using find and save.    forum.hibernate.org

Session s = HibernateSession.currentSession(); // open a new session Criteria c =s.createCriteria(User.class); c.add(Restrictions.eq("id",id.trim())); // set uuid.hex for id List l = c.list(); User u = l.get(0); u.setId(""); u.setUsername("public china"); s.saveOrUpdate(u); // for adding a new record s.beginTransaction().commit(); show error as following: Hibernate: select this_.id as id0_, this_.username as username1_0_, this_.password as password1_0_, this_.nickName as nickName1_0_, this_.website as website1_0_, this_.type as type1_0_, ...

18. How to save parents and kids in arbitrary order?    forum.hibernate.org

19. Hibernate 2 issuing 2 queries to save new object    forum.hibernate.org

20. is paging saved in session or DB    forum.hibernate.org

21. If query works - why not save? (where clause)    forum.hibernate.org

22. How to refresh a collection after some save/delete?    forum.hibernate.org

I have a question for refresh a collection. In my program, I first read some data from database by session.createQuery("from GroupRelation").list(); Then, I make some insert into the GroupRelation table by session.save(object). However, I find I must requery the table, then I can find the insert result in the collection. Otherwise, even I used flush()/refresh(object) or load(), they can not make ...

23. get Query object when save, or saveOrUpdate    forum.hibernate.org

24. Save queries to a file    forum.hibernate.org

25. avoid extra select query on saving object with many-to-one    forum.hibernate.org

I have an object with a field mapped many-to-one e.g : Code: Course { User user ; ... }

26. saving IDs of queried objects in a LRU cache for pagination    forum.hibernate.org

Hi, i have a query which does need quite a bit of time (5 secs - up to 1000 items) and i want to improve the performace for pagination. So i thought about fire this query just one time, and then save the IDs of this query in a Least Recently Used cache (LRU) with the query object as the key. ...

27. saving a query    forum.hibernate.org

28. Need Help: Query result not refreshed after save or update .    forum.hibernate.org

Hi , I had a problem to refresh my query after save or update operations, the query result is not changed after the corresponding record updated. It happen randomly, but very critical to the user using application developed with Hibernate. I use webwork as the framework for web development. Hibernate version: 3.2 Mapping documents: Bank statement file object ...

29. Proper order to save a hierarchal set of entities, ordered?    forum.hibernate.org

Hey all, I've got this decl in class Survey (an entity): Code: @OneToMany( cascade={ CascadeType.PERSIST, CascadeType.MERGE }, mappedBy="survey") @IndexColumn(name="ORDER_IDX", base=1) private List responseGroups = new ArrayList(); But I find that ORDER_IDX is always NULL. This is my save procedure ...

30. Saving named queries to external locations    forum.hibernate.org

Hello, I'm wondering if it makes sense to store named queries in a location entirely external to the application, e.g. to an external file or the database. This could make sense in some rare cases when the HQL query is incorrect and there are no changes to the actual Java code necessary. In this case changing the query would not require ...

31. Query cache stops working after object save    forum.hibernate.org

Hello, I have following problem. It seems like HB Query cache stops working as soon as given object type is being saved (it does not matter if it was save to existing object or insert of new object instance). The code looks like this: // #1 query = session.createQuery("from User where userID = :id"); query.setCacheable(true); query.setParameter("id", 10); user = (User) query.list().get(0); ...

32. Saving count(*) in an annotated entity    forum.hibernate.org

33. when saving several selects execute b4 inserting    forum.hibernate.org

Newbie Joined: Mon Dec 15, 2008 1:32 am Posts: 3 [Running Hibernate 3.3.1] I have a little bit of a challenge. I have got a situation where when I try to do an insert in a table by saving an object i get like 3 select statement executed be4 the actual insert takes place. My object structure is simple. An Item ...

34. save function is working but CreateQuery() showing exception    forum.hibernate.org

hi i am new to hibernate. i have made a application in which i can insert or save the record into mysql database but when i am doing CreateQuery("from Login") then after running , on tomcat screen it is showing "LOGIN is not mapped". But in same table i can insert the data. please guide me where i am wrong.