save « Fetch « JPA Q&A





1. Hibernate: save and retrieve immediately    coderanch.com

Hi there, I have a particular requirement where in I need to insert data into a table via Hibernate and fetch it back immediately. Typically (correct me if I am wrong) in Hibernate there is 1 operation for insert and then a subsequent operation for fetch. I want to somehow chain these 2 operations into one transaction such that the session ...

2. Able to retrieve object with collection but not saving.    forum.hibernate.org

I have doing the very first example: Person and Event It defines the one-to-many relationship. One person is assigned many events. My problem is that i m not abled to store event for a person. But i can retrieve details. xml goes like this:

3. Best way to execute code after successful save/retrieve    forum.hibernate.org

I'm curious as to the best place to put some code that I want to execute after save or retrieve completes. Currently I have done this in the Interceptor's onSave and onLoad methods, but these are called BEFOR save or load is completed. I believe I could cache all the objects I receive in onLoad or onSave and then iterate over ...

4. Save/Update/retrieve bi-directional one-to-many association    forum.hibernate.org

I have a bi-directional one-to-many association and I want to call the parent.saveOrUpdate() to save both parent and child. I want Hibernate to distinguish between a save or update but it cannot. Instead, I used a work around --> Parent p = p.load(parentID); and if parent is loaded then update(); else save(). That works but I think I should be able ...

5. retrieve derived field on save/update -- tagging system    forum.hibernate.org

is there any way to retrieve a derived field on save or update? the reason i need to do this is because I am trying to implement a tagging system, where each tag has an auto-generated ID from the database, but i want the tag itself to be the unique property. for example there is only one tag named 'test' in ...

6. Hibernate saves an empty object when fetching an other    forum.hibernate.org

Hibernate version: 3 Situation: I have 3 classes that are linked 1 that holds a collection of objects of type 2 and type 2 holds 1 of type 3 When i save 1 all the others get saved as well (all good there), cascade is set to save-update as it should. The problems start when i try to fetch an object ...

7. Retrieve newly saved object ID    forum.hibernate.org

8. Fetch problem after save/update    forum.hibernate.org

Hi all!! I have a problem with 2 entities. Example: Code: @Entity public class Person{ ..... @ManyToOne @JoinColumn(name="id_adress") private Address address; ...... } and @Entity public class Address{ ..... @Id @Column(name="id_address") private Long idAddress; ...