The SQLj initiative defines three ways to combine Java and SQL:
SQLj Part 0 defines a mechanism for embedding SQL calls within Java code. The SQL is converted into JDBC calls by using a preprocessor.
SQLj Part 1 inverts this, placing Java within SQL. It defines extensions to the SQL syntax to allow Java static methods to be called either as if they were SQL stored procedures or as user-defined functions within SQL statements.
SQLj Part 2 also places Java within SQL, but here defining a mechanism for Java classes to be used to define SQL types. This allows table columns to be defined as a type of a Java class; a Java object instance can thus be stored directly in the column.
The SQLj Part 0 has already been adopted as an ANSI and ISO standard ...