Hello everyone,
currently i am trying to set up an OData Service via Java JPA. I created a JPA Model with all my entities and also create a pom.xml to load all dependencies for Olingo as described in this blog post:
However, everytime when i try to puslish my code to the hana trial server i receive the following error message:
Problem while publishing
Problem while publishing
Problem during deploymentDeploy failed. Problem updating system DB with metadata for application [trackingclaim] in account [p1941566117trial].
Details: accounts/p1941566117trial/applications/
Deploy failed. Problem updating system DB with metadata for application [trackingclaim] in account [p1941566117trial].
Details: accounts/p1941566117trial/applications/
Something is wrong with the database configuration. My persistence.xml looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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/persistencehttp://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="trackingclaim" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>ibm.trackingclaim.model.Claim</class>
<class>ibm.trackingclaim.model.ClaimAttachment</class>
<class>ibm.trackingclaim.model.ClaimObjectCategorie</class>
<class>ibm.trackingclaim.model.ClaimState</class>
<class>ibm.trackingclaim.model.Country</class>
<class>ibm.trackingclaim.model.Customer</class>
<class>ibm.trackingclaim.model.Insurance</class>
<class>ibm.trackingclaim.model.InsuranceType</class>
<class>ibm.trackingclaim.model.Title</class>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.jpql.parser" value="org.eclipse.persistence.queries.ANTLRQueryBuilder"/>
</properties>
</persistence-unit>
</persistence>
The JPAEntityManagerFactory:
public class JPAEntityManagerFactory {
public static final String DATA_SOURCE_NAME= "java:comp/env/jdbc/DefaultDB";
public static final String PERSISTENCE_UNIT_NAME="trackingclaim";
private static EntityManagerFactory entityManagerFactory = null;
public static synchronized EntityManagerFactory getEntityManagerFactory()
throws NamingException, SQLException {
if (entityManagerFactory ==null)
{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(DATA_SOURCE_NAME);
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("javax.persistence.nonJtaDataSource", ds);
entityManagerFactory = Persistence.createEntityManagerFactory(
PERSISTENCE_UNIT_NAME, properties);
}
return entityManagerFactory;
}
}
The TrackingCliamServiceFactory.
public class TrackingClaimServiceFactory extends ODataJPAServiceFactory {
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = JPAEntityManagerFactory.getEntityManagerFactory();
oDataJPAContext.setEntityManagerFactory(emf);
oDataJPAContext.setPersistenceUnitName(JPAEntityManagerFactory.PERSISTENCE_UNIT_NAME);
return oDataJPAContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
Somebody know why this is not working with JPA.
Best regards
Manjinder Singh