-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MappingException in 3.0.1.RELEASE #161
Comments
Is there an upgrade guide for 3.0.1.RELEASE? I am seeing similar issues. |
Did you both specificy base-package for your entities in the configuration? It is now mandatory, and what you see is the enabled strict-checking in the MappingContext. see the blog post: http://blog.neo4j.org/2014/03/spring-data-neo4j-progress-update-sdn-3.html |
Yep, that was the problem for me. Put that in my |
Not sure if this would be possible, but it would be nice if the exception message was more helpful. The docs for Spring are often hard to deal with; tracking down info for your specific version and combination of components is pretty tough at times. |
Unfortunately that exception is generated by SD-Commons. We could only capture that, check he message and re-throw with a better message which also sucks. Actually the base-package attribute is mandatory in the 3.0 xsd but the xsd alias still points to 2.x |
Ah, I see. Well, hopefully uncle Google will find this issue if anyone else runs into it :) |
I am trying to upgrade and I cannot get past this error at all! below is my current XML set up, I am getting the same error with Java Config <neo4j:config graphDatabaseService="graphDatabaseService" base-package="com.company.dataservice.entities" />
<neo4j:repositories base-package="com.company.dataservice.repositories" />
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase"
destroy-method="shutdown">
<constructor-arg index="0" value="http://localhost:7474/db/data" />
</bean>
<bean id="neo4jTemplate" class="org.springframework.data.neo4j.support.Neo4jTemplate">
<constructor-arg index="0" ref="graphDatabaseService" />
</bean>
<bean id="neo4jMappingContext" class="org.springframework.data.neo4j.support.mapping.Neo4jMappingContext" />
<bean id="transactionManager" class="org.springframework.data.neo4j.config.JtaTransactionManagerFactoryBean">
<constructor-arg index="0" ref="graphDatabaseService" />
</bean>
<bean id="hibernateExceptionTranslator" class="org.springframework.orm.hibernate4.HibernateExceptionTranslator" /> |
@scuthbertson Which error are you exactly getting? Btw. there are not real transactions over REST. Youu usually don't have to configure the template, mappingcontext or tx-Manager. |
Hi @jexp, it was the exact error that @monitorjbl was having, the Unknown persistent entity error. Ah, OK, thanks for the pointer. I am upgrading from 2.3.2.RELEASE to 3.0.1.RELEASE and moving from Neo4J 1.9.5 to 2.0.1 I have rolled back to the 3.0.0.RELEASE of Spring Data Neo4J and appear to be having better success. Cheers for the help. |
Don't roll back, it is a feature not a bug. Strict checking would have been enabled in 3.0.0 already if there hadn't been an issue in SD-Commons. What is the exact error message? Which bean is not found? Is it part of the |
Hi @jexp OK, since my last communication, I have reverted back to 3.0.0, and have it in a semi-working state using the Java Config, I just need to update all of our custom Cypher to be Neo4J compliant. I changed my gradle settings to use SDN 3.0.1.RELEASE and the following error happens:
My Java Config is (It's identical to my previous XML): @Configuration
@EnableNeo4jRepositories(basePackageClasses = { Neo4jRepositoryConfig.class },
excludeFilters = { @Filter(Configuration.class) })
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
@PropertySource({ "classpath:company.application.properties" })
public class Neo4jRepositoryConfig extends Neo4jConfiguration {
@Resource
private PropertyResolver propResolver;
public Neo4jRepositoryConfig() throws ClassNotFoundException {
setBasePackage("com.company.dataservice.entities", "org.springframework.social.connect.neo4j");
}
@Bean(destroyMethod = "shutdown")
public GraphDatabaseService graphDatabaseService() throws IOException {
return new SpringRestGraphDatabase(propResolver.getRequiredProperty("neo4j.server.url") + "/db/data");
}
@Bean
public Neo4jTemplate neo4jTemplate() throws IOException {
return new Neo4jTemplate((GraphDatabase) graphDatabaseService());
}
@Bean
public Neo4jMappingContext neo4jMappingContext() {
return new Neo4jMappingContext();
}
@Bean
public JtaTransactionManagerFactoryBean transactionManager() throws Exception {
return new JtaTransactionManagerFactoryBean(graphDatabaseService());
}
@Bean
public HibernateExceptionTranslator hibernateExceptionTranslator() {
return new HibernateExceptionTranslator();
}
} The Member entity is inside my entities package. This config works with SDN 3.0.0.RELEASE as I have said but just that my Cypher does not comply at the moment. |
Weird Can you try it with only one parameter passed to setBasePackage() ? I assume in spring-social there are no @NodeEntity annotated Pojos? I also saw that there is no base-package on @EnableNeo4jRepositories ? And as I said there are no transactions over the wire. Just so that you are not surprised by the behavior. Currently I rather recommend going with embedded Neo4j than server if you want to have fun. :) |
I have
in the @EnableNeo4jRepositories, is this not the same behaviour as There is one POJO with @NodeEntity in there but it is a Jar that I have Trying with just one in there, has the same result. :-( On 25 March 2014 17:22, Michael Hunger [email protected] wrote:
|
Would you be able to create a test project that exhibits this behavior? I can't reproduce it locally. Thanks! |
Hi Michael, I will have a look at this tomorrow for you. Cheers, Steven On 25 March 2014 18:02, Michael Hunger [email protected] wrote:
|
@jexp I was able to produce this error by following the spring.io example https://github.com/spring-guides/gs-accessing-neo4j-data-rest Same error as above Tried the following versions. spring-data-neo4j:3.0.1.RELEASE --WORKED |
@ccit-spence Sent a pull request to that project, you have to add a constructor to the Application that sets the base package:
|
Works perfectly now... spring-data-neo4j:3.1.0.BUILD-SNAPSHOT |
Hi @jexp, I have been trying to create a project for you that is replicating this issue but I cannot seem to get a project set up that replicates this. It appears to be something in the setup then of our full project that is throwing this all off. Sorry for the bother. |
Closed. Issue out of date. |
I tried updating to 3.0.1.RELEASE today from 3.0.0.RELEASE. I'm unable to use the new version at all due this exception below. I ended up switching back to 3.0.0.RELEASE.
This class has the
@NodeEntity
annotation, so I'm not sure what's going on here. Did something change in the latest version? Do I need to include a different kind of annotation on my model POJOs now?The text was updated successfully, but these errors were encountered: