size « Map « JPA Q&A

1. Specifying field size of Map collection in grails DOM

I have a Grails 1.3.7 domain class that is declared like this:

class Document {
    String url

    Map metadata = new HashMap()

    static ...

2. object.children.size() possible without initializing?

After reading and experimenting with the 2nd level cache quite extensively, I've gotten to a situation where I want to simply count the number of children of an object, but not initialize those children. In fact, I have the join cached in a collection cache and it would be totally fine with me if I could simply get a size() call ...

3. order by children size

Hibernate version: 3.2 I'm in situation that I have to list items up ordered by children's count. Let me say parent is 'User' and children is 'Order'. This is basic one-to-many relation. One user can have multiple orders. I've already finished working on mapping file and generation POJO, etc. Then how can I get the list which tells top 10 users ...