contain « Collection « JPA Q&A





1. How to persist a Collection which contains different types    forum.hibernate.org

It depends on how your data is modeled. If Books, lighters, sausages, etc. are all in one table (product) then you'd probably want a subclass. You would need a discriminator column in the table to tell hibernate which type of class to construct when loading them. The documentation has some examples of hibernate mappings. If your items have a common database ...

2. Collections containing different types of objects + history    forum.hibernate.org

What we want to do is a bit different from the standard way people use relational databases. The objects we want to store contains a [b]variable[/b] ammount of items in a collection and each item may be [b]one of several[/b] known objects. I already saw something similar on the forum posted by [sfarrel] and [dotski81] We have public class ItemContainer { ...

3. Using contains for collections with HSQL?    forum.hibernate.org

Hi, Say I have a Cat object which has a one to many collection Kittens such that myCat.getKittens() returns a collection of Kitten objects. If there is a method Kitten.getName(), how might one, say, select all Cats which have Kittens of name Fred? I am envisioning something like: "Select Cat from cats as cat where cat.kittens.contains(kitten.name='Fred')" (I know my HSQL is ...

4. collection.contains() returning false    forum.hibernate.org

Author Message pitosalas Post subject: collection.contains() returning false Posted: Thu May 06, 2004 8:37 am Beginner Joined: Tue Sep 30, 2003 4:16 pm Posts: 33 I am using Hibernete 2.1, with HSQLDB 1.7.1. This is a further simplification of a previous post which is still causing me problems. Essentially a call to collections.contains(x) is returning false where it should ...

5. Why does collection not contain what I've added??    forum.hibernate.org

Author Message javacoda Post subject: Why does collection not contain what I've added?? Posted: Wed Jul 21, 2004 10:32 am Regular Joined: Fri Jul 16, 2004 3:04 pm Posts: 52 Location: Wiltshire UK Hi All, after a couple of weeks of struggling & reading various documentation & posts here, I am on my final attempt to get many-to-many relationships ...

6. Updating persisted object which contains collections    forum.hibernate.org

Hibernate version: Mapping documents: Code between sessionFactory.openSession() and session.close(): Full stack trace of any exception that occurs: Name and version of the database you are using: Debug level Hibernate log excerpt: Consider the following scenario. I am dealing with these classes A, B, C Instances of A contain a collection of B objects and a collection of C objects I create ...

7. collection.contains filter?    forum.hibernate.org

[junit] The collection was unreferenced; nested exception is net.sf.hibernate.QueryException: The collection was unreferenced [junit] org.springframework.orm.hibernate.HibernateQueryException: The collection was unreferenced; nested exception is net.sf.hibernate.QueryException: The collection was unreferenced [junit] net.sf.hibernate.QueryException: The collection was unreferenced [junit] at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3450) [junit] at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3513) ...

8. contains() method for a collection is not working properly !    forum.hibernate.org

Author Message fgozman Post subject: contains() method for a collection is not working properly ! Posted: Mon Sep 26, 2005 11:37 am Newbie Joined: Fri Apr 15, 2005 3:59 am Posts: 7 Hi all ! I have a relation 1-to-n between Constitution and Information. In Constitution I have a set of Information objects. I think that the method "contains()" ...





10. Failure to save object which contains a collection of compon    forum.hibernate.org

Newbie Joined: Fri Mar 20, 2009 4:37 am Posts: 6 Hi I'm using Spring 2.5 + Hibernate JPA. I have a class which contains a collection of components. Whenever I try to save an object of that class, I get the error: could not get or update the next value. Here is the code: Code: @Entity public class Vendor implements Serializable ...