Java Dictionary

SAP Developer Network

This Document Provides Answers to Frequently Asked Questions About:


What is Java Dictionary?

SAP Web Application Server (SAP Web AS) provides the Java Dictionary framework for managing database objects and application-wide data types. Rather than using the proprietary tools of a DBMS vendor, you simply edit the database objects in the Dictionary perspective of the SAP NetWeaver Developer Studio. Once defined, your database objects work immediately on your favorite DBMS platform (supported by SAP Web AS).

You get the most out of the Java Dictionary technology if you apply it in conjunction with the SAP NetWeaver Development Infrastucture (NWDI).

Back to top

Are there data types in Java Dictionary?

Yes. Java Dictionary provides portable data types. There are two kinds of them:

  • Built-in types: These are ready-to-use, predefined types; for example “string(10),” “integer,” “timestamp." The built-in types map to standard JDBC types and they are portable and ready to run on each supported DBMS platform. It means that they are proven to behave identically on each supported DBMS platform.

  • Simple types: In Java Dictionary you can apply the type derivation and build your own types on top of the build-in types. For a simple type, you can define the value range and some extra properties, for example the default value. You can maintain texts that can be displayed on the user interface (Dynpro or WebDynpro).

Please refer to the Java Persistence documentation for detailed information about working with data types in Open SQL for Java.

Back to top

Where are the JDBC types in the table editor of Java Dictionary?

Actually, in Java Dictionary you do not work with JDBC types. Rather, you work with pre-defined types called built-in types (for example, ”integer,” "float,” “timestamp,” “string”). The built-in types map to the standard JDBC types.

Why is this indirection necessary? Well, for example, there are some differences in the semantics of the JDBC types across the supported DBMS. The built-in types eliminate this drawback: They are proven to behave identical on each supported DBMS platform. Your data domain is ready to run immediately on each supported DBMS.

Back to top

As I have read in the documentation, Open SQL for Java defines the default mapping between Java Dictionary build-in data types and JDBC data types. If so, why does Java Dictionary define its own types instead of working with JDBC types directly?

First, there are some differences in the semantics of the JDBC types across the supported DBMS. An example here is the handling of strings independent of their length (JDBC types VARCHAR, LONGVARCHAR, CLOB). In contrast, Java Dictionary strings are proven to behave equally on whole supported platforms.

Second, Java Dictionary types minimize the TCO of your system, as they make the data type definition durable over a long time period. Java Dictionary types remain valid even if the JDBC types vary in future JDBC versions. Good news: Not you, but rather the Java Dictionary framework, takes care of the proper type conversion.

Third, let us point at the advantage of the built-in data types in a context of a whole application development. Java Dictionary projects are intended to centrally define application-wide data types that could be used in other project types, for example in Web Dynpro projects. Note that the built-in types free Web Dynpro developers - intended to be experts in the UI design area - of learning all the details about the database-related JDBC types. For example, you can simply apply the built-in type “string” for a character string instead of racking your brain for which JDBC type - VARCHAR, LONGVARCHAR, CLOB - is appropriate!

Back to top

Can I generate Java Dictionary descriptions for existing tables that were not created with Java Dictionary?

SAP Web AS 6.40: No. This feature request has been listed in the requirements for the SAP Web AS.

Back to top

Can I create additional indexes for Java Dictionary tables “on the fly” - at runtime, in the target database system, using proprietary database tools? Or, do I have to create them in the Java Dictionary editor and redeploy the tables?

You can create additional indexes directly in the database. Better, you can also adjust the corresponding Java Dictionary project so further system installations benefit in a straightforward way from the knowledge gained that creating an index is advantageous in this use case.

Back to top

Java Dictionary: How can I create a unique index? (Is this what selecting the Key checkbox does?)

Selecting a Key checkbox for a table field results in adding the field to the primary key of the table. According to the primary key definition, a unique primary index will be created in the database implicitly.

Obviously, you can define additional unique indexes, namely in the tab 'Indexes' in a table editor of Java Dictionary (select the 'unique' checkbox for the index).

Back to top

Does Java Dictionary support foreign key constraints? Is there a way to enforce referential integrity between tables?

No. Admittedly, you can set the foreign key constraints for your data domain if you model it with EJB entity beans with Container-Managed Persistence (EJB CMP). Please take into account that setting the foreign key constraints can impact the system’s performance.

Back to top

Can I define authorization restrictions in the Java Dictionary editor – for example: “Only selected users are allowed to edit tables”?

The authorization restrictions, comparable to those available in the ABAP Dictionary, are not available in the Java Dictionary in SAP Web AS 6.40.

Back to top

I want to save my table definition, but the “Save” button is not active. How can I save my work?

SAP Web AS 6.40: In the scope of a Java Dictionary project please use the “Save All Metadata” button to save the project contents.

Back to top

I design Java Dictionary tables and types as parts of the node “Local Dictionary.” Are there other dictionaries?

Within the scope of Web Dynpro for Java projects, if you use the adaptive RFC technology, there are data types derived from ABAP Dictionary available as read-only.

Back to top

Can I deploy a Java Dictionary table along with the table content?

Yes. You can deliver the Java Dictionary table along the table content. There are two possibilities:

  • Export from a reference database

  • Specification of the table entries in an XML file (since SP5)

Note that there is no modification support for table entries that are delivered in this way. Therefore, you can deliver table entries with program character or for examples, but not for templates or customizing data.

Back to top

Does Java Dictionary support multilingual data?

Yes. In the scope of Web Dynpro projects, you can mark a field as “translatable.” The procedure is comparable to that of the ABAP Dictionary.

Back to top

Can I define views in Java Dictionary?

Not in SAP Web AS 6.40. The next release will support defining views.

Back to top

How can I delete or rename a table in Java Dictionary?

Deleting a table:

To delete a table, simply delete it in the Dictionary project. Don’t forget to rebuild and redeploy the archive: In doing so, you drop the real database table in the database.

The fine print: If you use Java Dictionary in conjunction with NWDI, you cannot reuse names of deleted database tables.

Renaming a table:

Java Dictionary does not support renaming tables. (Actually, it is hard to imagine a case when you need to rename a database table.)

Back to top

How can I modify a table definition? Which modification operations are available?

In general, you can modify table definitions directly in the SAP NetWeaver Developer Studio.

If affected tables already exist in the database, don’t forget to generate the archive again and to redeploy it to modify the definition of the actual table. The result of the deployment is DBMS-dependent. Namely, at deployment, Java Dictionary first checks if the underlying DMBS can execute the required modification in a straightforward way:

  • If yes, the modification is propagated to the database.

  • Otherwise, the so-called table conversion is required; the Java Dictionary informs you that the table conversion is required and it rejects the operation.

This means that the available range of modifications is DBMS-specific. Moreover, the impact of a specific operation can be different among different DBMS's.

Summarizing:

  • There are several modification operations that you can safely execute, like adding a column, adding an index, activating the table buffer, extending the primary key. (These are the commonly used table modification operations.)

  • Other operations, like dropping a column, deleting a table, and changing a column type are considered risky and you have to check the impact in the target database very carefully. For example, dropping a table column can result in losing the entire column of entries!

Back to top

Can I view the content of a database table from the SAP NetWeaver Developer Studio?

There is nothing like a SE16 (of ABAP) in Java.

Back to top

Copyright © 2005 SAP AG, Inc. All Rights Reserved. SAP, mySAP, mySAP.com, xApps, xApp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product, service names, trademarks and registered trademarks mentioned are the trademarks of their respective owners.

SAP Developer Network