Update: By adding "@Transient" above the Collection name (followers) makes the Exception go away. Not sure i should be using @Transient becuase don't see any references to the annotation in the Manual or Spring Neo4 Example (@GraphProperty should be enough). Now the Neo4J Property (followers) is not being saved while JPA Properties do.
On Tuesday, June 3, 2014 4:23:34 PM UTC+1, [email protected] wrote: > > I have a Jpa entity which also acts as a Neo4j cross store. Most of the > fields in the entity are saved to Mysql database except the Collection > 'followers', which is stored in Neo4j. The problem is with the Collection > 'followers'. it throws the exception "hibernate MappingException: Could not > determine type for: java.util.Set". A quick search yields a bunch of Jpa > Related solutions (e.g. adding onetomany annotation to the field etc) which > I assume is not relevant in this case because the collection is saved in > Neo4j not Mysql. > > StacktraceCaused by: org.hibernate.MappingException: Could not determine type > for: java.util.Set, at table: game, for columns: > [org.hibernate.mapping.Column(followers)] > at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:314) > at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:292) > at org.hibernate.mapping.Property.isValid(Property.java:239) > at > org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:469) > at org.hibernate.mapping.RootClass.validate(RootClass.java:270) > at org.hibernate.cfg.Configuration.validate(Configuration.java:1303) > at > org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1761) > at > org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) > at > org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) > ... 16 more > -------@Entity@Table(name="game")@NodeEntity(partial = true)public class Game > implements Serializable{ > private static final long serialVersionUID = 1L; > > @RelatedTo(type="GAME", direction=Direction.INCOMING, elementClass = > Account.class) > @Fetch > > @GraphProperty > private Set<Account> followers = new HashSet<Account>(); > > > > @Id > @GeneratedValue(strategy=IDENTITY) > @Column(name="game_id") > private Long gameId; > @Column(name="name",unique=true) > private String name; .... > > //Accessors > > public Long getGameId() { > return gameId; > } > > > > public void setGameId(Long gameId) { > this.gameId = gameId; > }... > @Override > public String toString(){ > return "..."; > } > > > } > Neo4j Config > @Configuration > @ComponentScan(basePackages={".."})@EnableTransactionManagement(mode=AdviceMode.ASPECTJ)@EnableNeo4jRepositories(value={".."})public > class Neo4JConfig extends Neo4jConfiguration{ > > @Bean(destroyMethod = "shutdown") > @Scope(SCOPE_PROTOTYPE) > public SpringRestGraphDatabase graphDatabaseService(){ > SpringRestGraphDatabase springRestGraphDatabase = new > SpringRestGraphDatabase("http://localhost:7474/db/data"); > return springRestGraphDatabase; > > } > @Bean > public Neo4jTemplate neo4jTemplate(){ > return new Neo4jTemplate((GraphDatabase) graphDatabaseService()); > } > > @Bean > public Neo4jMappingContext neo4jMappingContext() { > return new Neo4jMappingContext(); > }} > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
