idbag « Core « JPA Q&A





1. ClassCastException using idbag on many-to-many    forum.hibernate.org

I can see that using an idbag on a many-to-many association is supported and people do use it, but I'm having a problem. I've searched google, jira, and this forum back to 2006, and found nothing similar. Can anyone help? I'm using JPA2 and Hibernate 3.5.1-final with annotations. Here's my association mapping: Code: @CollectionId( ...

2. idbag and identity keys    forum.hibernate.org

I've made enough changes to AbstractCollectionPersister BasicCollectionPersister IdentifierBag in order to not try to write the id during the insert I still need to retrieve the id after insert though What's weird is the following test case: Query q = session.createQuery("select hawb from test.TestHawb hawb where hawb.hawb='TEST'"); TestHawb hawb = (TestHawb)q.list().get(0); TestRef ref = new TestRef(); ref.setRef("REF4"); hawb.getRefs().add(ref); session.flush(); System.out.println("Hawb: " ...

3. idbag for many-to-many relationship    forum.hibernate.org

Regular Joined: Mon Sep 08, 2003 10:05 am Posts: 50 Location: Dublin, Ireland I have inherited an existing table structure to represent a many-to-many relationship between Portfolios and Customers, and I want to represent this as simply as possible. Because the occurrence table (CDB_PORTFOLIO_TO_CUSTOMER) has columns other than just the customerid and portfolioid, my only option for (directly) using a many-to-many ...

4. idbag duplicates rows    forum.hibernate.org

Hi, Looks like I've encountered a case when idbag duplicates some values. Let's imagine this simple case, we have 3 tables: SELECTION, SELECTED and FIELD. SELECTED is the middle table for the many-to-many relation between SELECTION and FIELD. Now I load a selection ad add the first field to it. Everything works fine. Then I do it again; I reload the ...

5. Questions about idbag and surrogate keys    forum.hibernate.org

Hi, I have 2 classes having a many-to-many relationship between them. In the database, I have 1 table per class + a join table. This join table has the form: Relation_ID (PK) Table1_ID (FK) Table2_ID (FK) Additional_Field There is a unique index on Table1_ID and Table2_ID. To map that relationship, I use the idbag collection type. I think this is the ...

6. IDBAG trying to insert null into collection-id on update    forum.hibernate.org

Author Message dolanh Post subject: IDBAG trying to insert null into collection-id on update Posted: Wed Jun 16, 2004 5:37 pm Newbie Joined: Wed Jan 07, 2004 5:30 pm Posts: 11 Location: SF, CA Hi all, Hib version 2.1.4., Oracle 8i. The basic problem is this. I have an Article object with a List (mapped as an Idbag) of ...

8. idbag constructor for association    forum.hibernate.org

Hibernate version: 2.1.6 Name and version of the database you are using: MySQL 4.0.14 The generated SQL (show_sql=true): insert into Cart_Shopable (id_cart, id, id_shopable) values (?, ?, ?) I use a table with some extra colums for a association of a Cart and a Shopable (Cartitem). The problem I have: the constructor for Cart_Shopable is never called, so I can not ...

9. "Caveat Emptor": using for Categoriz    forum.hibernate.org

Referring to the Caveat Emptor example application: Could you please provide an example CategorizedItem class that allows use of rather than in Category.hbm.xml to store Category.categorizedItems() in a List rather than a Set? There's an example configuration (commented out) in Category.hbm.xml, but as the comment states the packaged CategorizedItem class will not work with the mapping. The ...





10. idbag and identity column    forum.hibernate.org

Does an idbag support the idenity column yet? If so which version supports it. When trying to update an object (which is updating a collection) I get: Caused by: java.lang.ClassCastException at net.sf.hibernate.type.IntegerType.set(IntegerType.java:34) at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48) at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35) at net.sf.hibernate.collection.AbstractCollectionPersister.writeIdentifier(AbstractCollectionPersister.java:401) at net.sf.hibernate.collection.IdentifierBag.writeTo(IdentifierBag.java:298) at net.sf.hibernate.collection.AbstractCollectionPersister.insertRows(AbstractCollectionPersister.java:609) at net.sf.hibernate.impl.ScheduledCollectionUpdate.execute(ScheduledCollectionUpdate.java:49) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2394) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)

11. retrieve id of an idbag??    forum.hibernate.org

12. idbag possible bug in beforeRemove after insert    forum.hibernate.org

Hi, I think I found a bug in the idbag. It occurs when you insert a new element and delete an old one just after in the same session. In the 2.1.8 version, the code of the beforeRemove method is Code: private void beforeRemove(int index) { Object removedId = identifiers.get( new Integer(index) ); ...

13. idbag many-to-many with Set semantics    forum.hibernate.org

Currently I am using an to map a many-to-many association based on a pure association table with a surrogate primary key. It works fine, but I have to use Collection in my code, whereas I'd like to be able to use Set to keep things consistent. There is a database level uniqueness constraint on the two foreign keys in the ...

14. Allowing duplicates with idbag    forum.hibernate.org

Newbie Joined: Wed Mar 02, 2005 11:14 am Posts: 4 Hibernate version: 2.1.8 I'm trying to work with an existing database schema and am having difficulty with the mapping documents to allow me to persist duplicate data to a table. I have an ALBUM and a TRACK table. The business logic tells me that an ALBUM can have many TRACK's and ...

15. AnyBody have already used idBag?    forum.hibernate.org

I am using it with good results. I have a many-to-many relationship between a ProductRevision table and a Risk table. The association table has three columns: prod_risk_id, prod_rev_id, risk_id. prod_risk_id is an unnecessary primary key I am using because I don't like multi-column pk values. Here is my mapping for the association table: Code: ...

16. two idbag in one obect    forum.hibernate.org

Hibernate version: 3.0.2 Mapping documents: AC_ACCOUNT_ID_SEQ [...] AC_ACCOUNT_X_ROLE_ID_SEQ AC_ACCOUNT_X_PROFILE_ID_SEQ





17. idbag, equals() and hashCode()    forum.hibernate.org

Since I'm not 100% sure that it's a bug, I'd like to ask if there is any specific reason that idbag-managed collections do not implement equals() and hashCode(). I've found out that after switching to idbags, equals() stopped working. I've checked the PersistentIdentifierBag and it seems like neither it nor its superclasses override equals() and hashCode() methods. Is there any specific ...

18. Yet another Many-To-Many idbag question...    forum.hibernate.org

View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] Yet another Many-To-Many idbag question... Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message equality72521 Post subject: Yet another ...

19. IDBAG semantics and Oracle9i    forum.hibernate.org

I have a strange problem with idbag semantics... i use the mapping document posted here (values with no type specified are simply strings), and with HSQLDB file database i don't have any problem. Using Oracle9i, the code not works, and the problem is in the element tag of idbag semantics, that in oracle not supports references to custom objects (but with ...

20. Many-to-many with extra columns. idbag vs. Object    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Im currently working with a legacy database. As you can see I have a person and an issue that are joined with a many to many relationship. The many to many table has some extra columns that I need to persist and return. I attempted to use a ...

21. How to use in idbag    forum.hibernate.org

Hey, i use in hyperjaxb2 , it generate a jaxb and hiebenate mapping from xsd. it supports for collection only in : Bag,Idbag,List i have many to many relation (no need for biderctional) lets say : Book: bookId- assign by application (pk) name Company: companyId -assign by application (pk) name. I have a table Book_To_Comany with column: bookId companyId i want ...

22. can i do idbag with cascade?    forum.hibernate.org

23. idbag causes inefficient database sync    forum.hibernate.org

Hi folks, Hibernate version: 3.2 Tried to make the following simple idbag mapping:

24. idbag of objects that have idbags, second set not persisted    forum.hibernate.org

I have classes A, B and C (each with their own table). A has a many-to-many B kept in association table AB. Each of those has a many-to-many to C kept in association table AB_C. Because the AB relationship is related to more information that just which A is related to which B, it also must maintain relationships to C, I ...

25. idbag    forum.hibernate.org

...

26. idbag and adding an element at position 0    forum.hibernate.org

Hello, I have a great problem: Master-detail-data is mapped as an idbag (lazy, with order-by-clause) Reading a master with some detail elements is no problem. Afterwards one detail element is modified, and one new element is added AT POSITION 0 !! -> coll.add(0, newElem); After saving (master) some of the detail elements are missing in the database. Only two are left ...

27. Compile error on idbag. Can't get the xml to work.    forum.hibernate.org

Somethins is either wrong with the java or the xml but i have no idea which it is. Just that it won't compile. Code: ...