Tuesday, June 19, 2018

Create New ADF Business Component Issue in Jdeveloper 12c

In JDeveloper 12c I will show you one of the issue you may face when you try to create new Entity Object or create ADF Business Components From Table.

For this example I have an ADF application with model project and I want to create one new Entity Object in the model project:

- Right click on the Model Project --> New --> Entity Object


- You will find there is no Database Schema and You can't Browse schema object.


- In the Model project if you check if there is a database connection is defined in ADF Business Components or not, you will find there is a database connection defined.



So where is the problem?

Let us try to create the entity using Business Components From Table


You will find in the third step, there is no schema and you can't shuttle anything and the wizard will stop in this step as shown:


When you have a look on the JDev log, you can find exception like:

SELECT /*OracleDictionaryQueries.ALL_VISIBLE_USERS_QUERY*/
U.USERNAME, 'SCHEMA', NULL OBJECT_ID, NULL LAST_DDL_TIME
FROM SYS.DBA_USERS U
WHERE EXISTS ( SELECT 1
               FROM   SYS.DBA_TAB_PRIVS_RECD TPR
               WHERE  TPR.OWNER = U.USERNAME )
AND U.USERNAME LIKE ?
UNION
SELECT USER, 'SCHEMA', NULL OBJECT_ID, NULL LAST_DDL_TIME FROM SYS.DUAL
oracle.javatools.db.DBSQLException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

        at oracle.javatools.db.execute.StatementWrapper.createDBSQLException(StatementWrapper.java:711)
        at oracle.javatools.db.execute.ConnectionWrapper.call(ConnectionWrapper.java:199)
        at oracle.javatools.db.execute.ConnectionWrapper.call(ConnectionWrapper.java:117)
        at oracle.javatools.db.execute.ConnectionWrapper.run(ConnectionWrapper.java:102)
        at oracle.javatools.db.execute.QueryWrapper$QueryExecutionRunnable.runImpl(QueryWrapper.java:459)
        at oracle.javatools.db.execute.StatementWrapper$ExecutionRunnable.run(StatementWrapper.java:920)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper.runAndLog(ProgressBarExecutionWrapper.java:137)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper.access$000(ProgressBarExecutionWrapper.java:37)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper$R.run(ProgressBarExecutionWrapper.java:181)
        at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:961)
        at java.lang.Thread.run(Thread.java:748)



The reason of this issue come from the database user privileges. To fix this issue follow the following steps:

1- Connect to sys database and grant dba to the database user which you use in ADF application Model.


2- Restart Jdeveloper.

3- Now try to create new Entity or Create Business Component From Table, it should be ok and works fine.