Show TOC Start of Content Area

Procedure documentation Configuring the Persistence Unit  Locate the document in its SAP Library structure

Use

To use a real data source you need to configure a persistence unit name with the corresponding data source alias. Then you can use in your source codes this logical name (data source alias) and directly the persistence unit name for references to the real data source available in the system.

First you specify the data source alias in data-source-aliases.xml , and then you define the persistence unit name in persistence.xml. You can find their names below:

·        Persistence unit name: ems/EJB_EDM_DEMO_PU

·        Data source alias: CE_RA_DS

Procedure

...

       1.      From the context menu of the EDMProjectEARDemo project, navigate to Properties Project Facets and choose Modify Project.

       2.      Select the SAP Data Source Aliases Provider Module indicator and choose Finish, and then OK.

The data-source-aliases.xml displays in the Project Explorer view under EDMProjectEARDemo/EarContent/META-INF.

       3.       Open for editing data-source-aliases.xml, select the General tab, and enter the name of the alias CE_RA_DS in the Aliase name field.

This graphic is explained in the accompanying text

Leave the default Data source name: ${com.sap.datasource.default}

       4.      Open for editing the persistence.xml  under EDMProjectEJBDemo/ejbModule/META-INF and choose the Source tab.

       5.      To enter CE_RA_DS for jta-data-source, paste the following code in the persistence.xml.

<?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/EJB_EDM_DEMO_PU">

<jta-data-source>CE_RA_DS</jta-data-source>

</persistence-unit>

</persistence>

 

 

 

 

 

End of Content Area