count « Load « JPA Q&A





1. where is the best palce to count the lazy load property using JPA    stackoverflow.com

Let's say we have a "Question" and "Answer" entity,

@Entity

public class Question extends IdEntity {
    @Lob
    private String content;
        ...

2. Hibernate count collection size without initializing    stackoverflow.com

Is there a way I can count the size of an associated collection without initializing? e.g.

Select count(p.children) from Parent p
(there is a good reason why I cant do this any other way ...

3. Counting an objects collection (with filter) without loading    forum.hibernate.org

Looking for advice on this and it's best if I present an example to explain... I have a ShoppingCart object that holds many Items. The item object has a flag isPerishable When I get the object ShoppingCart I would like to know how many Item objects it holds are of type isPerishable, the only way I know how to do that ...

4. Getting the child collection count without loading    forum.hibernate.org

Hi, I'm using NH3 with Fluent, I've a PostCategory class as below, public class PostCategory : BaseEntity { public virtual string Name { get; set; } public virtual string Description { get; set; } public virtual int CategoryOrder { get; set; } public virtual IList Posts { get; private set; } public PostCategory() { Posts = new List(); } } How ...

5. Best Method:Working Lazy-loading Sets + Counting Collections    forum.hibernate.org

@Entity @Table(name = "user", catalog = "myapp") public class User implements java.io.Serializable { private static final long serialVersionUID = 1L; private String userName; . . . . private Set

address = new HashSet(); private Set message = ...