The simple CLI-application for executing JPQL (Java Persistence Query Language) queries to databases.
It needs a Java Virtual Machine of at least version 1.6 (Java SE 6.0). If you want to build the jar from source, you will also need Maven.
-
Build with Maven:
mvn package
-
Unpack created archive jpql-executor*.zip.
-
Place the required JDBC-driver for your database into the lib directory.
-
Run application with following syntax:
jpql-executor.bat <entities archive> <unit name> <JPQL query>
Where:
entities archive - the jar-file with entity classes (@Entity),
unit name - the persistence unit name described in the persistence.xml inside jar-file with entity classes,
JPQL query - the query stringExample:
jpql-executor.bat entity.jar default "SELECT entity FROM Entity entity"
The application is execute in unmanaged environment as JavaSE program (without application container).
Therefore possible to use only persistence.xml with explicit database
properties
(url, user, password) and not with JNDI and other EE technologies.
The MetaJ library publish under the Apache Software License, Version 2.0.
Last build status on Travis CI: