You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jack <ss...@gmail.com> on 2017/06/06 12:45:04 UTC
Hibernate ORM with PostgresSql with Karaf 4.1.0
I used Hibernate ORM with PostgresSql.
And below is the persistence.xml for Hibernate ORM with PostgresSql.
<?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/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="store" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=store)</jta-data-source>
<class>com.data.vo.Store</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.url"
value="jdbc:postgresql://localhost:5432/RMA" />
<property name="hibernate.connection.driver_class"
value="org.postgresql.Driver" />
<property name="hibernate.connection.username"
value="postgres" />
<property name="hibernate.connection.password"
value="admin" />
</properties>
</persistence-unit>
</persistence>
I have fine the persistence.xml in the MANIFEST using the following
configuration statement to the maven-bundle-plugin:
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
I have placed my persistence.xml file in location
src/main/resources/META-INF/persistence.xml.
When I try to get the persistence object using
Persistence.createEntityManagerFactory, I get the below exception
Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for
EntityManager named store
I tried below options also.
1) Tried changing to MYSQL/PostgresSQL drivers for connecting to the DB
2) Made configuration changes in eclipse to remove the resource folder's
excluded list from *.* to None.
3) Tried with Eclipselink also
4) Tried setting the ContextClassLoader to a classloader that can see the
persistence provider as well as the database drivers.
But none of the above option solved by issue. I need some help on this.
--
View this message in context: http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050580.html
Sent from the Karaf - User mailing list archive at Nabble.com.