Question: This query:

```
Query query = HibernateUtil.getSessionFactory().getCurrentSession().createQuery("SELECT substring(a.account, 1, 6), a.ref, b.event_id, substring(a.admin, 1, :adminLength) FROM Parent a, Child b WHERE b.joinString = a.joinString AND b.event_id=:eventId AND substring(a.admin, 1, :adminLength) LIKE :admin AND a.date BETWEEN :from AND :to");

```

Produces a SQL statement that works in MySQL.

However, when I loop through the Child `List` I get `java.lang.ClassCastException` on the line `for (int j = 0; j < allParent.get(i).getAllChild().size(); j++) {` of this loop:

```
for (int i = 0; i < allParent.size(); i++) {
    System.out.println(allParent.get(i));
    for (int j = 0; j < allParent.get(i).getAllChild().size(); j++) {
           System.out.println("Child: " + allParent.get(i).getAllChild().get(j).getID());
    }
    HibernateUtil.getSessionFactory().getCurrentSession().flush();
    HibernateUtil.getSessionFactory().getCurrentSession().clear();
}

```

**Parent.hbm.xml**

```
<bag name="allChild" table="child" inverse="true" lazy="true" fetch="select">
    <key property-ref="surname">
        <column name="surname" not-null="true" />
    </key>
    <one-to-many class="com.test.Child" />
</bag>

```

Is there a way I can run this statement using `Criteria` (or something else) instead and have it populate both `allParent` `List` and `allChild` `List` linked to each `Parent` within `allParent`?

Answer: 
Yes, it's perfectly fine to add multiple content `View`s at the root level. The content `View`s are simply added to a `FrameLayout` container, and it is best practice to simply use it for your layout if a `FrameLayout` is all you require for it, instead of adding an additional container layer.

If you are adding a new content `View`, then you should use the `addContentView()` method instead of `setContentView()`, which would cause the existing content to be replaced instead.

Also, it is possible to add multiple `View`s to the content container in XML layouts as well by using the [`<merge>` tag](http://developer.android.com/training/improving-layouts/reusing-layouts.html#Merge), which would just replace the base `FrameLayout`.
Calling `setContentView` several times will simply replace whatever view you set before. So what you want to do is create a root view that contains the multiple views you want to add and set the root view to your Activity with `setContentView`. Your second example with the `FrameLayout` is a good approach.