# ORM 'Navigation' is your friend

Don't be tempted to hand-write queries that are equivalent to navigations between entities:

    			BatchControlId batchControlId = ...
    			Query<BatchControlParameter> query = createQuery("from BatchControlParameter parm where parm.id.batchControlId = :parentId");
    			query.bindId("parentId", batchControlId);
    			List<BatchControlParameter> list = query.list();

DO: Use this instead - it'll use the cache and will almost certainly be faster:

    			BatchControl batchControl = id.getEntity();
    			if (batchControl == null) { /* oh oh */ }
    			BatchControlParameters list = batchControl.getParameters();

Parent topic: Object-Relational Mapping: Background