Question: I have two classes:

```
@Entity
@Table(name="shops")
public class Shops {
    private Integer id;
    private String name;
    // ...
}

@Entity
public class ShopsPlus extends Shops {
    public Double latitude;
    public Double longitude;
    // ...
}

```

Class 'Shops ' is used in order to reflect 'shops' table (normal entity).
The second class ('ShopsPlus') includes several additional fields, which aren't present in the first class and used to get result from query with calculated fields.

Example:

```
Query query = session.createSQLQuery("SELECT shops.id, shops.name
                                      COS(?) AS latitude,  /*example*/
                                      SIN(?) AS longitude  /*example*/
                                      FROM shops
                                      WHERE localities.name = ? 
                                      AND localities.id = shops.locality_id;")
               .addEntity(ShopsPlus.class)
               .setString(0, a.toString())
               .setString(1, a.toString())
               .setString(2, cityName);
List<Shops> shops = query.list();

```

After that in the table there were three excess fields: 'latitude', 'longitude' and 'DTYPE'.

**How I can forbid the class "ShopsPlus" to make changes to the table, but thus to leave such opportunity for "Shops"?**

Answer: 
This is an `NSObject` that implements the `HTTPResponse` protocol. So you can call any `HTTPResponse` methods on the returned value.

If `HTTPResponse` inherits from the `NSObject` protocol (which is distinct from the `NSObject` class), then the usual way to express this is `id<HTTPResponse>`. But `NSObject<HTTPResponse> *` isn't wrong.
It means

> 
> NSObject pointer that implements the HTTPResponse protocol
> 
> 
> 

So you were close. It could be `NSObject *`, but you'd be loosing a lot of information that the compiler can use and you'd need to do a lot of casting to compensate for that.

In a number of ways it would be better to use `id < HTTPResponse >` and to ensure that the `HTTPResponse` protocol extended the `NSObject` protocol as this provides the required guarantees to the compiler but also gives more flexibility in the underlying object type (for instance to use an `NSProxy`).