This thesis addresses the optimization of a Java code generator in the fields of Model-Driven Architecture (MDA) and dependable distributed systems. The generated Java code represents integrity constraint validation code, which is generated from OCL constraints that are defined on a UML model. This Java code generator does not always produce the most efficient code with respect to its run-time performance, because of deep nested loops. For this purpose, a OCL to SQL transformer was implemented that generates SQL code validating constraints on the database layer. Furthermore, this work introduces a transformation algorithm that allows to split OCL constraints into their incoherent parts and to transform these parts separately. Hence, it is possible to validate one constraint using Java and SQL. Finally, an evaluation of the run-time performance of the generated Java constraint validation code shows that the performance is considerably increased.