That's the catch with CMP Entity Beans. The container will write the SQL for you. Most container vendors, I would imagine, will not let you hack the logic that generates the SQL statements (Although
you should check the docs for your container). The db relationships in our shop are complex so we use BMP Entity Beans with Data Access Objects (DAOs) which use stored procedures.