Re: [Neo4j] Spring-Data neo4j

109 views
Skip to first unread message

Michael Hunger

unread,
Jul 24, 2012, 6:29:59 AM7/24/12
to ne...@googlegroups.com
This should work
Can you share your full config and how you load the spring context files

And what the actual issue is

Sent from mobile device

Am 24.07.2012 um 10:21 schrieb Javier Molina <javi...@gmail.com>:

Hello!

 
I'm working in a project related with neo4j. Now I'm trying to use spring-data neo4j and I have a big problem. My problem is about spring-data neo4j configuration. When I implement my app, I have to set some mapped-files size to launch  tests, and this configuration is never loaded.
I try to implement a bean like this:

<bean id="graphDatabaseService"
class="org.neo4j.kernel.EmbeddedGraphDatabase"
destroy-method="shutdown" scope="singleton">
<constructor-arg value="target/db" />
<constructor-arg>
<map>
<entry key="use_memory_mapped_buffers" value="true" />
<entry key="cache_type" value="none" />
<entry key="neostore.nodestore.db.mapped_memory" value="10M" />
<entry key="neostore.propertystore.db.mapped_memory" value="40M" />
<entry key="neostore.relationshipstore.db.mapped_memory"
value="2G" />
<entry key="neostore.propertystore.db.index.keys.mapped_memory"
value="5M" />
<entry key="neostore.propertystore.db.index.mapped_memory"
value="5M" />
<entry key="neostore.propertystore.db.strings.mapped_memory"
value="1M" />
<entry key="neostore.propertystore.db.arrays.mapped_memory"
value="0M" />
</map>
</constructor-arg>


<neo4j:config graphDatabaseService="graphDatabaseService" />


and, on the other hand, I try to read from a neo4j.properties or graph.db file but neither works.
I'm looking for a solution that allows me set neo4j configuration, if someone can help me I'll be grateful.

Thanks a lot.

Javier Molina

unread,
Jul 26, 2012, 3:22:46 AM7/26/12
to ne...@googlegroups.com
This is my test declaration:

@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration

public class GraphTest {


//    @Value(value = "${spe.depth}")

    private int maxDepth = 2;


    private int TOTAL_IDS = 10000;


    

    @Autowired

    private GraphDatabaseService graphDatabaseService;


then, I use graphDatabaseService to getIndex().

Michael Hunger

unread,
Jul 26, 2012, 3:44:28 AM7/26/12
to ne...@googlegroups.com
what is the complete content of your:

GraphTest-context.xml ?

And how do you check that the config was not used?

Michael

Javier Molina

unread,
Jul 27, 2012, 3:19:34 AM7/27/12
to ne...@googlegroups.com
This is my .xml:


<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx" xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"

xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation="

http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/context 

http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/data/neo4j

       http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd                

        ">


<context:annotation-config />



<!-- Getting provided configuration -->

<bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations" value="graph-test.properties" />

</bean>




<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"

destroy-method="shutdown">

<constructor-arg index="0" value="target/db" />

<constructor-arg index="1">

<map>

<entry key="use_memory_mapped_buffers" value="true" />

<entry key="cache_type" value="none" />

<entry key="neostore.nodestore.db.mapped_memory" value="10M" />

<entry key="neostore.propertystore.db.mapped_memory" value="40M" />

<entry key="neostore.relationshipstore.db.mapped_memory"

value="2G" />

<entry key="neostore.propertystore.db.index.keys.mapped_memory"

value="5M" />

<entry key="neostore.propertystore.db.index.mapped_memory"

value="5M" />

<entry key="neostore.propertystore.db.strings.mapped_memory"

value="1M" />

<entry key="neostore.propertystore.db.arrays.mapped_memory"

value="0M" />

</map>

</constructor-arg>

</bean>





<!-- Neo4j configuration (template) -->

<neo4j:config graphDatabaseService="graphDatabaseService" />

<neo4j:config storeDirectory="target/db" />



<!-- Package w/ automagic repositories -->

<neo4j:repositories base-package="neo4j" />


</beans>


So, to check it, I saw message.log in db/ that specifies neo4j configuration.

Thanks.

Michael Hunger

unread,
Jul 27, 2012, 3:40:04 AM7/27/12
to ne...@googlegroups.com
Remove this line

<neo4j:config storeDirectory="target/db" />

This overrides the previous:  <neo4j:config graphDatabaseService="graphDatabaseService" /> 
which is the real one.

Michael

Javier Molina

unread,
Jul 27, 2012, 6:11:37 AM7/27/12
to ne...@googlegroups.com
I fix it with yours suggestion.

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages