collection « Insert « JPA Q&A





1. hibernate insert to a collection causes a delete then all the items in the collection to be inserted again    stackoverflow.com

I have a many to may relationship CohortGroup and Employee. Any time I insert an Employee into the CohortGroup hibernate deletes the group from the resolution table and inserts all ...

2. Hibernate inserting into join table    stackoverflow.com

I got several entities. Two of them got a many-to-many relation. When I do a bigger operation on these entities it fails with this exception:

org.hibernate.exception.ConstraintViolationException: could not insert collection rows:
I execute ...

3. Hibernate collection not updated when records inserted externally    stackoverflow.com

I've a mapped collection that is not updated when I add items to that collection externally, in another application. Second-level caching is disabled. Example...

session = HibernateDataSource.openSession();
User dao = (User) session.load(User.class, 2434152);
// No items ...

4. Problem with one-to-many collection when inserting    forum.hibernate.org

Hi all, I have an entity called "Expediente" which has a collection of "Ambito". Expediente hbm looks like this: Code: ...

5. Hibernate not insert re-attached collection? (bug?)    forum.hibernate.org

version: 3.6.0.final I have the following situation: An entity with a collection, containing value type objects, with cascading fully enabled. 1) I remove, the collection and store it to the db. Then load it to check that the collection indeed is removed. 2) I then add the removed collection and store the entity again. Then I load it again to check ...

6. Efficient collection insert    forum.hibernate.org

8. Collection tries to re-insert existing data on update    forum.hibernate.org

I have a User object with a property of type bag which is a collection of objects representing IDs of items the user wishes to view. When the user attempts to update this collection, I get a primary key constraint violation, which I assume is due to Hibernate trying to re-insert pre-existing data. Here is the code for my update: User ...

9. Post DDL changes - Failed to lazily initialize a collection    forum.hibernate.org

Author Message rnmixon Post subject: Post DDL changes - Failed to lazily initialize a collection Posted: Sat Dec 06, 2003 3:18 pm Beginner Joined: Tue Sep 09, 2003 5:20 pm Posts: 43 I have made some minor adjustments to my MySQL 4.0.13 DDL that Hibernate uses. Added a few columns, renamed one column, dropped a couple. I made the ...





10. Inserting an object in a Collection    forum.hibernate.org

I have a bean which has three attributes, where one of them is a Collection. the other two are name and info. the name and info attributes hardly ever change, but the third attribute (the collectio) is always receiving new values to it. the xml mappings are correct, and i can make it work if i hard-code the collection id with ...

11. collection element is considered "inserted" though    forum.hibernate.org

Newbie Joined: Thu Apr 08, 2004 8:46 am Posts: 11 Location: Istanbul Here, I have a problem that I minimized into 2 classes and hsqldb for easy re-generation of the issue. I have a List of Bars under Foo. It is declared to be cascade="all-delete-orphan" and inverse="true". I create a new "Foo" and add a "Bar" under it. Then I try ...

12. error inserting in collection. Many-to-Many    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Im trying to implements many-to-many with the tables: Atividade (Activity) - AtividadeCliente (ClientActivity) - Cliente (Client) I tried to implement in two ways: 2 one-to-many and using composite-element. In two ways id had the same problem. integrity constraint (ADEB.ADC_ATV_CL_ADC_CLI_FK) violated - parent key not found Ive tried to execute the generated query query ...

13. Bogus INSERT into collection link table    forum.hibernate.org

Hibernate version: 2.1 Okay, so I've got a lazy Set in an object that has been reattached (using the "Session per request" design model)... The write-behind does an SQL INSERT into the link table corresponding to this Set, and this INSERT takes a "Duplicate key" error (the link table uses a composite key). I've instrumented the routine that does the Set.add() ...

14. I can't insert the entire collection, just only the last one    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:Hibernate2.18 I have two entity (Item Bid), they are One to many relation. Code:

15. value collections are inserted with get()-method    forum.hibernate.org

Hello, I have a problem with this Code: Code: Teil teil = (Teil) session.get(Teil.class, teilId); HibernateUtil.commitTransaction(); HibernateUtil.closeSession(); Every Time I want to get a Teil from the database, Hibernate insert the values of the value collection "reichweite". The first run, one line is inserted. The second run two lines, the third 4 lines, the fourth 8 lines and so on. I ...

16. Collection Dirty! Hibernate keeps deleting and inserting    forum.hibernate.org

Author Message cmchugh Post subject: Collection Dirty! Hibernate keeps deleting and inserting Posted: Thu Nov 02, 2006 2:32 pm Newbie Joined: Fri Jun 23, 2006 9:25 am Posts: 10 Ok. I have this collection which implemented using a mapping/association table. This table has an extra column which stores the order of the associated objects. I have a problem with ...





17. Problem inserting nested collections with datasource configu    forum.hibernate.org

Author Message pravsemilo Post subject: Problem inserting nested collections with datasource configu Posted: Thu Jun 26, 2008 8:48 am Newbie Joined: Thu Jun 26, 2008 8:10 am Posts: 4 Hibernate version:3.2.6ga Mapping documents: --FeedbackRequest.hbm.xml FEEDBACK_REQUEST_SEQ ...

18. Inserting a single value into an existing collection    forum.hibernate.org

I have a Two objects : Batch and User The relation is many to many between them. User can belong to many batches. Batch can have Many Users. now i want to add a new User to an Existing Batch. Mapping is as follows

19. can't insert a collection of elemenets    forum.hibernate.org

@Entity @Table(name = "ENT_A") public class EntA implements Serializable { ... @Id public Long getOid() { return oid; } [b]@CollectionOfElements(targetElement = EntB.class) @JoinTable(name = "ENT_B", joinColumns = @JoinColumn(name = "OID_ENT_A")) @MapKey(columns = @Column(name = "CODENTB")) public Map getEntb() { ...

20. Collection references are deleted and re-inserted    forum.hibernate.org

Author Message fbristow Post subject: Collection references are deleted and re-inserted Posted: Wed Apr 15, 2009 1:53 pm Newbie Joined: Wed Apr 15, 2009 12:41 pm Posts: 2 Hi Everyone, This is not really a big problem right now, I'm mostly curious about the cause of the problem, but a solution would be nice! :) My problem is that ...