SQL « Collection « JPA Q&A





1. How to check if the collection is empty in NHibernate (HQL)?    stackoverflow.com

I have a following HQL query: SELECT s.id FROM ...

2. Hibernate One-To-Many Could Not Initialise Collection    stackoverflow.com

I have two database tables, User and PageComment. Using Hibernate, I'm trying to store a Set of PageComment objects in the User comment (comments made to that user), by using one-to-many ...

3. Hibernate collection dirty checking causing extra SQL update    forum.hibernate.org

Pro Joined: Tue Aug 26, 2003 8:07 pm Posts: 229 Location: Brisbane, Australia I' ve got a Person object that has a collection of Address objects. When I save() a brand new Person object (with an empty set of Address objects) Hibernate issues an insert on the person table (good) and then an update on the person table (bad, or at ...

4. sql-type definition in collection-element big_decimal    forum.hibernate.org

Well, after some diving into the hbm2ddl and dialect code I found a solution / workaround: big_decimal is mapped to java.sql.Type.NUMERIC The SQLServerDialect defines "Numeric(19,$l)" as default. The scale is set by replacing $l with length from the mapping. Maybe their could be a hint added in the documentation, about the meaning of length ...

5. Manually initialize a collection without SQL?    forum.hibernate.org

I have the following table structure where each line represents a lazy loaded many-to-one collection. Code: A | B ...

7. Return collections instead of object[] with sql-qry    forum.hibernate.org

Is this possible? In the 3.1 beta documentation it seems possible: Code: SELECT NAME AS {pers.*}, {emp.*} FROM PERSON pers LEFT OUTER JOIN EMPLOYMENT emp ON pers.ID = emp.PERSON_ID WHERE ID=? I've worked this into my own mapping with an example very similar to the above and have been playing with many ...

8. Setting filter on collection producing invalid SQL    forum.hibernate.org

Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message n8thesk8 Post subject: Setting filter on collection producing invalid SQL Posted: Wed Mar 01, 2006 10:59 am Newbie Joined: Fri Jun 24, 2005 10:40 am Posts: 17 I am setting a hibernate filter on a collection ...

9. Urgent: Please help with Collection/Native SQL    forum.hibernate.org

I have the following table structure that I am trying to map using hibernate Table A { a_id b_id1 a_col1 a_col2 } Table B { b_id1 b_id2 b_col1 b_col2 } Table A has a single col primary key where as B has a composite key with 2 columns. Now I am trying to map these 2 tables where each row in ...





10. Empty Collections being returned even though sql returns thm    forum.hibernate.org

I'm at a total loss here. I'm attempting to load a one-to-many set collection and the POJO isn't reflecting what the SQL is saying. I'm doing something like this: -------------- Set barSet = foo.getBars(); log(barSet.size()); for(Iterator it = barSet.iterator(); it.hasNext();) { ... } log("DONE WORKING WITH BARS"); ---------------- No matter what the resulting SQL pulls back I ALWAYS get a set ...