Show TOC

Procedure documentationPreparing the Data Source and Generating Tables Locate this document in the navigation structure

Procedure

Entering a New Data Source Alias in the Data Source XML
  1. To configure the data source, open the data-source-aliases.xml under EAR project / META-INF.

  2. Under Aliases , leave the default data source name, but enter SMPLFD_EDM_DS_ALIAS for the alias name.

  3. Select the Source tab page and ensure the displayed code is the following:

    Syntax Syntax

    1. <?xml version="1.0" encoding="UTF-8"?> 
      <data-source-aliases  	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  	xsi:noNamespaceSchemaLocation="data-source-aliases.xsd"> 
      	<application-name>LocalDevelopment~LocalDevelopment~app_ear~demo.sap.com</application-name> 
      	<aliases> 	
      	<data-source-name>${com.sap.datasource.default}</data-source-name> 	
      	<alias>SMPLFD_EDM_DS_ALIAS</alias> 	
      </aliases>
       </data-source-aliases>
    End of the code.
Defining the Persistence Unit in the Persistence XML
  1. To configure the persistence unit and its name, open the persistence.xml under app_ejb/ejbModule/META-INF.

  2. Select the Source tab page and enter the following source code:

    Syntax Syntax

    1. <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      
      
      <persistence-unit name="ems/EJB3_simpl_EDM_DEMO_PU">
      		<description>EDM EJB3 Demo Application Persistence Unit</description>		
      		<jta-data-source> SMPLFD_EDM_DS_ALIAS</jta-data-source>
      		<properties>
               <property name="com.sap.engine.services.orpersistence.generator.versiontablename"
               value="EDM_VERSIONGEN"/>
            	</properties>	
      	</persistence-unit>
      </persistence>
    End of the code.
Generating the Entities' Tables
  1. Open the context menu of the app_ejbproject.

  2. Select   JPA Tools   Generate DDL  .

    Now you can see the generated tables under the app_dict.