Hibernate ogm Neo4j объект управления ошибкой
Я пытаюсь подключиться к базе данных Neo4j. Моя база данных загружена с сайта Neo4j "Cineacts Actors &Movies". Он расположен на C:\NewMovies
вот мое приложение:
public class App
{
private static final String JBOSS_TM_CLASS_NAME = "com.arjuna.ats.jta.TransactionManager";
public static void main( String[] args )
{
TransactionManager tm = getTransactionManager();
//build the EntityManagerFactory as you would build in in Hibernate Core
EntityManagerFactory emf = Persistence.createEntityManagerFactory("ogm-jpa-tutorial");
System.out.println( "Hello World!" );
}
public static TransactionManager getTransactionManager() {
try {
Class<?> tmClass = App.class.getClassLoader().loadClass( JBOSS_TM_CLASS_NAME );
return (TransactionManager) tmClass.getMethod( "transactionManager" ).invoke( null );
} catch ( ClassNotFoundException e ) {
e.printStackTrace();
} catch ( InvocationTargetException e ) {
e.printStackTrace();
} catch ( NoSuchMethodException e ) {
e.printStackTrace();
} catch ( IllegalAccessException e ) {
e.printStackTrace();
}
return null;
}
}
мой файл постоянства:
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.0">
<persistence-unit name="ogm-jpa-tutorial" transaction-type="JTA">
<!-- Use Hibernate OGM provider: configuration will be transparent -->
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<class>com.mycompany.hibernateneo.Movie</class>
<properties>
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.neo4j.database_path" value="C:/NewMovies" />
<!-- defines which JTA Transaction we plan to use -->
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/>
</properties>
</persistence-unit>
</persistence>
мой файл сущности:
@Entity
@Table(name = "Movie")
public class Movie {
@Id
String id;
@Basic
String title;
@Basic
String description;
@Basic
private String language;
@Basic
private String imdbId;
@Basic
private String tagline;
@Basic
private Integer runtime;
@Basic
private String homepage;
@Basic
private String trailer;
@Basic
private String genre;
@Basic
private String studio;
@Basic
private Integer version;
@Basic
private String imageUrl;
public Movie() {
}
public Movie(String id, String title) {
this.id = id;
this.title = title;
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public void setTitle(String title) {
this.title=title;
}
public void setLanguage(String language) {
this.language = language;
}
public void setImdbId(String imdbId) {
this.imdbId = imdbId;
}
public void setTagline(String tagline) {
this.tagline = tagline;
}
public void setDescription(String description) {
this.description = description;
}
public void setRuntime(Integer runtime) {
this.runtime = runtime;
}
public void setHomepage(String homepage) {
this.homepage = homepage;
}
public void setTrailer(String trailer) {
this.trailer = trailer;
}
public void setGenre(String genre) {
this.genre = genre;
}
public void setStudio(String studio) {
this.studio = studio;
}
public void setVersion(Integer version) {
this.version = version;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getLanguage() {
return language;
}
public String getImdbId() {
return imdbId;
}
public String getTagline() {
return tagline;
}
public Integer getRuntime() {
return runtime;
}
public String getHomepage() {
return homepage;
}
public String getTrailer() {
return trailer;
}
public String getGenre() {
return genre;
}
public String getStudio() {
return studio;
}
public Integer getVersion() {
return version;
}
public String getImageUrl() {
return imageUrl;
}
public String getYoutubeId() {
String trailerUrl = trailer;
if (trailerUrl==null || !trailerUrl.contains("youtu")) return null;
String[] parts = trailerUrl.split("[=/]");
int numberOfParts = parts.length;
return numberOfParts > 0 ? parts[numberOfParts-1] : null;
}
}
и ошибка, которую я получаю:
Исключение в потоке "main"..buildEntityManagerFactory(Ejb3Configuration.java:890) в org.hibernate.ejb.Persistence.createEntityManagerFactory(Persistence.java:63) в javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) в com.mycompany.hibernateneo.App.main(App.java:22), вызванный: org.hibernate.Mapping: Не удалось получить конструктор для org.hibernate.ogm.persister.SingleTableOgmEntityPersister в org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185) в org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) в org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:385) в org.hibernate.cfg.Configuration.buildhactjactjacthact.ejb.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:94) в org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ... еще 6 причин: org.sphere.service.serser. запрошенный сервис [org.hibernate.ogm.dialect.impl.GridDialectFactory] в org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:186) в org.hibernate.serviceIIverRejervice.jergService.service.Service.Service.Service.Service.Service.Service.Service.Service.Service.Service.Service.Service.Service.Rj:150) в org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) в org.hibernate.ogm.datastore.impl.DatastoreServicesInitiator.initiateService(DatastoreSerervicesInitiator.java:50) в org.hibernate.ogm.datastore.impl.DatastoreServicesInitiator.initiateService(DatastoreServicesInitiator.java:39) в org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.inergister.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) в org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.: 131) на org.hibernate.ogm.persister.OgmEntityPersister.(OgmEntityPersister.java:129) на org.hibernate.ogm.persister.SingleTableOgmEntityPersister.(SingleTableOgmEntityPersister.java:47) в sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) в sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) в java.lang.reflect.Constructor.newInstance(Constructor.java:526) в org.hibernate.persister.internal.PersisterFactoryImpl.create (PersisterFactoryImpl.jpg): 11). больше Причины: java.lang.IllegalArgumentException: свойство hibernate.ogm.neo4j.database.path не может быть пустым в org.hibernate.ogm.datastore.neo4j.impl.EmbeddedGraphDatabaseFactory.validate(EmbeddedGraphDatabaseFactnate.javahiber61).ogm.datastore.neo4j.impl..neo4j.impl. tServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) в org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) в org.hibernate.ridia.jpg в org.hibernate.ogm.dialect.impl..SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:91) в org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:176) 26 больше...
пожалуйста, есть идеи?
1 ответ
Удалить
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/>
из файла persistence.xml. HibernateOGM для neo4j в настоящее время использует обходное решение для транзакций внутри самого OGM.
Это теперь отражено в последнем бета-руководстве. Посмотрите на окно предупреждения