SQLJ / PLJAVA Tutorial
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
SQLJ - PLJAVA in PostgreSQL
SQLJ - is used to implement methods java inside the database
What is SQLJ SQLJ is the collection of java programming extensions. It allow to programmers using the Java programming language to embed statements that provide SQL database funtions. It can also define as SQLJ enables applications programmers to embed SQL operations in Java code
- Create new class in sqlj/src
- insert the new method in the new class (the method must be static)
- create a new function in PostgreSQL
- insert type and name of arguments in the parameters and click in add
- in definition, insert path of method and type of argument
- modify sqlj.ddr in …adempiere_stable/sqlj/postgresql
- Example:
CREATE OR REPLACE FUNCTION getamtinwords(amount VARCHAR) RETURNS VARCHAR AS 'org.compiere.sqlj.AdempiereLBR.getAmtInWords(java.lang.String)' LANGUAGE 'java' VOLATILE;
- run_build.bat or run_build.sh
- replace or install the sqlj.jar
- Example: select sqlj.replace_jar('file:/c:/workspace/adempiere_stable/sqlj/sqlj.jar','sqlj',true);
- if necessary use set_classpath