Welcome, 

I've some problem with Hibernate mapping. 

**Database structure:**

```
TableA
 -ID_A --PK

TableB
 -ID_B --PK
 -ID_A -- FK -> TableA

TableC
 -ID_C -- PK
 -ID_A -- FK -> TableA

```

**POJO structure:**

```
class TableA extends Pojo {

 /*Some Fields*/

}

class TableB extends Pojo {

  TableA tableA; 

 /*Some properties*/

}

class TableC extends Pojo {

 TableA tableA;

 Collection<tableB> tableBs;

}

```

---

What i want to have is the collection of TableB elements in mapping for a TableC Pojo, the mapping key is the tableA. 

This collection should be read only. 

The mapping should be hbm not annotations. 

I have probably done this for every possible way... the closes i get is case that when i operate on one TableC object then is everything correct but if i load the collection of them then only the last one have proper collection set. 

UPDATE: Case description.

The use case 1: Loading single object of TableC

```
Session session = (Session) getHibernateTemplate().getSessionFactory().openSession();
SQLQuery sqlQuery = session.createSQLQuery("SELECT c.* FROM TableC c WHERE c.ID_C = 1"); //Oracle
  sqlQuery.addEntity("c", TableC.class);
return sqlQuery.list(); //Return list with sigle object of TableC

```

In this case everything works fine as should. The object is loaded with all data and proper items in list of TableB objects. 
On this object we can operate, change it and update the modifications in database. 

The use case 2 Loading collections of objects 

```
Session session = (Session) getHibernateTemplate().getSessionFactory().openSession();
SQLQuery sqlQuery = session.createSQLQuery("SELECT c.* FROM TableC c WHERE c.ID_C in (1,2)"); //Oracle
  sqlQuery.addEntity("c", TableC.class);
return sqlQuery.list(); // throws "collection is not associated with any session" 

```

In this case Hibernate throw an exception while retrieving next object. 

\*the codes are only samples, the session is closed after all.