Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 2.25 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Integration (maven) of Spring Data Neo4j in Dynamic Web Project using Jersey and Tomcat
  2. ...
  3. <repository>
  4.   <id>spring-milestone</id>
  5.   <name>Spring Maven MILESTONE Repository</name>
  6.   <url>http://maven.springframework.org/milestone</url>
  7. </repository>
  8.  
  9. <dependency>
  10.   <groupId>org.springframework.data</groupId>
  11.   <artifactId>spring-data-neo4j</artifactId>
  12.   <version>2.0.0.RELEASE</version>
  13. </dependency>
  14. ...
  15.        
  16. ...
  17. @NodeEntity
  18. public class Category {
  19.  
  20. @GraphId Long nodeId;
  21. String categoryType;
  22.  
  23. public Category(String categoryType){
  24.     this.categoryType = categoryType;
  25. }
  26.  
  27. }
  28. ...
  29.        
  30. @Autowired Neo4jTemplate template;
  31. @Test @Transactional
  32. public void toGraphDb() {
  33.  
  34.       template.save(new Category("mashineCategory"));
  35. }
  36.        
  37. ...
  38. <display-name>ElisaSimulatorM4</display-name>
  39.  
  40. <servlet>
  41.   <servlet-name>Jersey REST Service</servlet-name>
  42.    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
  43. <init-param>
  44.   <param-name>com.sun.jersey.config.property.packages</param-name>
  45.   <param-value>de.elisa.communication.webservice.restservice.implementation</param-value>
  46.   </init-param>
  47.   <load-on-startup>1</load-on-startup>
  48. </servlet>
  49.  
  50.  
  51. <servlet-mapping>
  52.   <servlet-name>Jersey REST Service</servlet-name>
  53.   <url-pattern>/rest/*</url-pattern>
  54. </servlet-mapping>
  55. ...
  56.        
  57. <beans xmlns="http://www.springframework.org/schema/beans"
  58.        xmlns:context="http://www.springframework.org/schema/context"
  59.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  60.        xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
  61.        xmlns:tx="http://www.springframework.org/schema/tx"
  62.        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  63.         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  64.         http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  65.  
  66.     <context:spring-configured/>
  67.     <context:annotation-config/>
  68.  
  69.     <neo4j:config storeDirectory="path/to/db"/>
  70.     <neo4j:repositories base-package="org.example.repository"/>
  71.  
  72. </beans>