Empty « Collection « JPA Q&A





1. JPA & Ebean ORM: Empty collection is not empty    stackoverflow.com

I've started switching over a project from hand-written JDBC ORM code to Ebeans. So far it's been great; Ebeans is light and easy to use. However, I have run into a ...

2. Hibernate - empty collections don't work with Criterias    coderanch.com

Hi, I want to select Users that belong to Public groups or don't belong to any groups at all. user<->group is a many to many assiociation. (user have a collection of groups associated or empty if doesn't belong to any). I have to use detachedCriterias, so I do as follows: DetachedCriteria crit = DetachedCriteria.forClass(User.class, "usr"); crit.createAlias("groups", "usrgroups"); Disjunction dis1 = Restrictions.disjunction(); ...

3. LazyInitializationException on an empty collection?    forum.hibernate.org

Hello all, I'm using Hibernate 3.4.0 through Spring+JPA. I'm seeing some weird behavior with collections that is causing a LazyInitializationException to occur. During an open transaction session I serialize an entity to XML. Objects that contain a PersistentBag with some data in it serialize just fine however objects that contain a PersistentBag that are empty (no data) are throwing the LazyInitializationException ...

4. Empty collection causes "two rep. of same collection"    forum.hibernate.org

org.hibernate.HibernateException: Found two representations of same collection: khdb.entities.KladdenEntry.verkaeufe at org.hibernate.engine.Collections.processReachableCollection(Collections.java:175) at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:60) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:124) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:84) at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:78) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:165) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206) ...

5. Empty Collection set generating Update statement    forum.hibernate.org

HI - I am new to hibernate and I spent hours but not able to find a proper solution. I am hoping I will get some hints from experts. I am loading the parent from XML file and the child is loaded with empty set. Before persisting the parent I check if the parent already exists using the PARENT_ID and in ...

6. CRASH BUG with debug logging and creating empty collections!    forum.hibernate.org

We have found that Hibernate crashes when its logging level is set to debug and we create an object with a bunch of empty collections. Changing the logging level to info avoids the crash. Here are the details: We are trying to create a data model we designed yesterday. The central object is a Campaign object which has four collections: a ...

7. Efficient way to empty a collection?    forum.hibernate.org

Let's say I have a many-to-many from one entity A to another entity B. And let's say that there could be many, many, many B's associated with a given instance a1. Now I want to delete a1. In order for this to work, I need to clean up the A-to-B association. Here's some code that could do it: Code: Iterator bInstances ...

8. Empty collection being returned. Not sure why though ...    forum.hibernate.org

Hi there ... :-) I wonder if someone can help me. I'm trying to retrieve a collection from an object, but I'm getting nothing back. Haven't a clue why this is, because it is stored correctly on the database. I've set up the following mappings: [code]

9. setParameterList causing error if the collection is empty    forum.hibernate.org

I'm building a query "from Lease lease where lease.property.propertyId in :properties" and then using setParameterList("properties", properties); This works fine if there are properties in the properties object. However, if that collection is empty, then Hibernate causes an error as shown below. I don't think this should be Hibernate's behavior. It seems like it should translate to just () and then notice ...





10. HQL with parameters always return empty collection.    forum.hibernate.org

Newbie Joined: Wed Feb 08, 2006 10:02 am Posts: 2 Location: Fortaleza - Cear - Brazil Hi, I have this problem: When I use one or more parameters in WHERE clausule of my HQL the result it's brings me nothing at all (collection not populated). I already tested the generated statement (with parameters) on my SQL client and returned many rows. ...

11. n:m relationsship and empty collection    forum.hibernate.org

Hi, I have a strange problem. I currentyl try to make a n:m relaationsship between two classes / tables THING and ACTION One THING contains one or more actions, while an ACTION can be assigned to different THINGS. So, I have a getter / setter in my THING class public Collection getActions() {... } Working with annotations, I added the following ...

12. Conjunction / Disjunction and Empty Collections    forum.hibernate.org

Hibernate version: 3.2.5 Name and version of the database you are using:Oracle 10g XE I have several tables. The first contains a set of data objects (Resources). Then, there are two permission tables. One to map user permissions to the resource objects and the other to map group permissions to the objects. Previously, I was issuing two queries, one for users, ...

13. Using Restrictions.in() with an empty collection    forum.hibernate.org

Hi, I have been using Hibernate for a few months now and I have to say it is by far the best ORM solution I have used, so first of all I would like to say thanks to all the Hibernate developers for making my life a lot easier. On to my question: this regards the use of Criteria Queries, and ...

14. How to avoid the creation of an empty collection?    forum.hibernate.org

Hello, When an array is made persistent, hibernate generates an extra table for the array's content. E.g: Code: @Entity class A { @Id int id; B b; } @Embeddable class B { @CollectionOfElements @IndexColumn(name="arrayIndex") C[] c; } @Embeddable class C { String bla; } I ...

15. Hibernate Returning empty collection    forum.hibernate.org

Newbie Joined: Fri May 22, 2009 8:26 am Posts: 2 Hi, I am new to Hibernate and is stuck up with a problem. I have 2 tables University and Pincode. I am trying to fetch the columns of the Pincode table for the University. But it is coming as empty collection. My mapping file-- ...

16. Collection is empty    forum.hibernate.org

Hello, I have some trouble understanding how hibernate works. I've got a one-to-many relationship like Person has one or more Phones. So I create a Person object and set an Collection of Phones to it. After persisting this with entityManager.persist, the Person is in the DB, and the Phones also. Ok, nice, now here is my problem, after retrieving the Person ...