Menu
  • HOME
  • TAGS

Unable to connect to MongoDB from local machine to Openshift using persistence.xml and hibernate ogm 4.1.1

mongodb,openshift,persistence.xml,hibernate-ogm

which version of OGM are you using? In the latest version the properties to specify host and port are: hibernate.ogm.datastore.host hibernate.ogm.datastore.port ...

All I want is to access a H2 mem database in Websphere V8 using JPA 2.0

java,jpa,jdbc,websphere,persistence.xml

Found it! These full JNDI names doesn't seem to work in Websphere. I used a plain "jdbc/sgodb" instead and it could find the context. <jta-data-source>jdbc/sgodb</jta-data-source> instead of <jta-data-source>java:comp/env/jdbc/sgodb</jta-data-source> ...

Inner class - unexpected token

java,inner-classes,persistence.xml

Paragraph 2.1 of the JPA specifications: The entity class must be a top-level class. So you can't use a nested class for an entity. Make it a top-level class....

No Persistence provider for EntityManager named DataSourcePostgres

java,jpa,persistence.xml

My problem was I didn't put the persistence.xml into a META-INF folder. After I fixed that everything worked.

DRY in persistence.xml

java,jpa,persistence.xml

create a orm file: <persistence-unit name="YOU_PU" ...> <provider>YOU_PROVIDER</provider> <mapping-file>orm.xml</mapping-file> Inside the ORM file you will write the entities. There is a sample here: https://github.com/uaihebert/uaicriteria/blob/master/src/test/resources/orm.xml...

it seems that hibernate is not reading the changes in the persistence.xml

hibernate,jpa,persistence.xml

I was using a wrong JDBC drive

Eclipse do not put the persistence.xml in my ear

java,xml,eclipse,maven,persistence.xml

Any way... i found a solution (i dont know if another one exists) and it was adding the resource into the <build> of the pom.xml <resource> <directory>src/main/resources/META-INF/</directory> <targetPath>${project.basedir}/target/classes/META-INF/</targetPath> <includes> <include>*.xml</include> </includes> </resource> ...

Error java.lang.InstantiationException

java,jsf,jpa,persistence.xml

I think should always look at the root cause of exception. In your case Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named k19pu at javax.persistence.Persistence.createEntityManagerFactory Your persistence.xml is not valid that's why EntityManagerFactory can't be get created. due this you are also getting NLP at CarroRepository#buscaTodos method Caused by:...

How to use OpenJpa using persistence.xml without using Enhance.xml ..?

openjpa,persistence.xml

If you rely on some non-IDE tool to build your app, you can enhance automatically during buildtime. For Maven, for example, see this

Openshift MySQL database contents resets at build

mysql,openshift,persistence.xml

You need to change your create-drop to something else, <property name="hibernate.hbm2ddl.auto" value="create-drop" /> Basically you are telling your application to drop all tables, and recreate them. You should look up other values for that option....

Disable internal logging of MOXy (eclipselink)

java,eclipselink,moxy,persistence.xml

The logging you wish to disable is SAX Parser logging. The odds are that at the moment there is no way to disable this logging from within MOXy. I have filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=461829

How to externalize properties of persistence.xml for JBOSS 7.1.1?

jboss7.x,datasource,persistence.xml

I use a method that works well for hibernate. 1) put the hibernate configuration properties in a xml file (call it hibernate.cfg.xml but it's not mandatory) this is an example: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>...

Still getting PersistenceException: No Persistence provider for EntityManager

java,hibernate,jpa,entitymanager,persistence.xml

Finally, after 4 hours of googling, I found the reason: Artifacts folder must have lib folder in its root with needed libraries: Hope it will help someone....