Re: Hibernate ORM with PostgresSql with Karaf 4.1.0

2017-06-08 Thread Jack
Hi added my project in below location

https://github.com/JackMic/hibernate---postgres--karaf.4.1.0

If some can download the project and solve my problem.

I'm almost trying from two weeks to resolve this issue.

Note : i'm using karaf 4.1.0





--
View this message in context: 
http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050582p4050628.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Hibernate ORM with PostgresSql with Karaf 4.1.0

2017-06-08 Thread Jack
Hi,

I have placed my datasource in deploy folder. 

 

 

You can see the details




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050582p4050615.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Hibernate ORM with PostgresSql with Karaf 4.1.0

2017-06-08 Thread Timothy Ward
Hi Jack,

As I posted in response to Stephen in another thread, Aries Transaction Control 
makes sorting out JPA quite a lot simpler. You end up with just one 
configuration to manage. I’m including that post below. The significant 
difference for you is that obviously you’ll want a Postgres driver rather than 
H2, and a Postgres Driver name/URL in the configuration.

Regards,

Tim

——

Hi,

Have you considered using OSGi Transaction Control rather than blueprint’s 
integration? Apache Aries has an implementation of this pre-release OSGi R7 
specification, and there are fewer moving parts. You can avoid deploying the 
blueprint/PAX JDBC pieces, and just use:

A JPA provider (OpenJPA 2.4, Hibernate 5.x, EclipseLink 2.6), 
Aries JPA Container 2.6.0 (none of the rest of Aries JPA will be needed)
Aries Transaction Control Service Local 

 (0.0.2 is available in Maven Central)
Aries Transaction Control JPA Local 

 (0.0.2 is available in Maven Central)
H2 (your database of choice?) which is already a fully paid up OSGi 
implementation 

If you then cut down your persistence unit to the bare essentials:

http://xmlns.jcp.org/xml/ns/persistence 
"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 

http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd 
">
 

   org.hibernate.ejb.HibernatePersistence
 


And create a factory configuration for pid 
org.apache.aries.tx.control.jpa.local containing:

osgi.unit.name=authentication
osgi.jdbc.driver.class=org.h2.Driver
url=

You should then be able to inject the Transaction Control service and the 
JPAEntityManagerProvider, just like in this example 


I hope this helps,

Regards,

Tim 

——

> On 8 Jun 2017, at 09:09, smunro  wrote:
> 
> Hello Jack,
> 
> I don't see anything in your example about creating a data source on karaf. 
> Have you defined a org.ops4j.datasource-.cfg for karaf?
> 
> Take a look at https://github.com/desolate-planet/osgi-jpa-demo this is just
> a simple demo I created to get past my issue.
> 
> A few things to try, once you've deployed your data source and your bundle,
> try the following in karaf:
> 
> service:list DataSourceFactory
> service:list DataSource
> 
> The above will confirm you have a data source factory and a data source with
> the desired name (store).
> 
> If you can verify the data source is available on karaf with the store name,
> then the problem lies in your dependencies.
> 
> I don't have your code at hand to compare, but check my feature file to see
> the repositories used as well as the versions of each feature.
> 
> Stephen
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050582p4050606.html
> Sent from the Karaf - User mailing list archive at Nabble.com.



Re: Hibernate ORM with PostgresSql with Karaf 4.1.0

2017-06-08 Thread smunro
Hello Jack,

I don't see anything in your example about creating a data source on karaf. 
Have you defined a org.ops4j.datasource-.cfg for karaf?

Take a look at https://github.com/desolate-planet/osgi-jpa-demo this is just
a simple demo I created to get past my issue.

A few things to try, once you've deployed your data source and your bundle,
try the following in karaf:

service:list DataSourceFactory
service:list DataSource

The above will confirm you have a data source factory and a data source with
the desired name (store).

If you can verify the data source is available on karaf with the store name,
then the problem lies in your dependencies.

I don't have your code at hand to compare, but check my feature file to see
the repositories used as well as the versions of each feature.

Stephen






--
View this message in context: 
http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050582p4050606.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Hibernate ORM with PostgresSql with Karaf 4.1.0

2017-06-06 Thread Jack
*Regards,Suman K+91-9886748169*

On Tue, Jun 6, 2017 at 6:15 PM, Jack [via Karaf] <
ml+s922171n4050580...@n3.nabble.com> wrote:

> I used Hibernate ORM  with PostgresSql.
>
> And below is the persistence.xml for Hibernate ORM with PostgresSql.
>
> 
> 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;>
>
> 
> org.hibernate.jpa.HibernatePersistenceProvider provider>
> osgi:service/javax.sql.DataSource/(osgi.
> jndi.service.name=store)
> com.data.vo.Store
>
> 
>  value="org.hibernate.dialect.PostgreSQLDialect"/>
> 
>  value="jdbc:postgresql://localhost:5432/RMA" />
>  value="org.postgresql.Driver" />
>  value="postgres" />
>  value="admin" />
> 
> 
>
> 
>
> I have fine the persistence.xml in the MANIFEST using the following
> configuration statement to the maven-bundle-plugin:
>
> META-INF/persistence.xml
>
> 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.
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://karaf.922171.n3.nabble.com/Hibernate-ORM-with-
> PostgresSql-with-Karaf-4-1-0-tp4050580.html
> To start a new topic under Karaf - User, email ml+s922171n930749h25@n3.
> nabble.com
> To unsubscribe from Karaf - User, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Re-Hibernate-ORM-with-PostgresSql-with-Karaf-4-1-0-tp4050581.html
Sent from the Karaf - User mailing list archive at Nabble.com.