Here is my entire Jpa/Neo4J Setup. Maybe I overlooked something?  In the 
meantime I will remove @Transient from the collections, resort back to the 
stage where I got the Exception (see initial post).

//Jpa Setup

@Configuration
@EnableTransactionManagement(mode=AdviceMode.ASPECTJ)
@EnableJpaRepositories(value={"com.repository"}, 
entityManagerFactoryRef="entityManagerFactory", 
transactionManagerRef="transactionManager")
@PropertySource("classpath:db.properties")
public class JpaConfig {
@Autowired
    private Environment environment;
 @Bean
public PlatformTransactionManager transactionManager() { 
JpaTransactionManager txManager = new JpaTransactionManager(); 
txManager.setEntityManagerFactory((EntityManagerFactory) 
entityManagerFactory());
return txManager; 
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() { 
LocalContainerEntityManagerFactoryBean factory = new 
LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
factory.setPackagesToScan("com.equitytwits.core");
factory.setJpaPropertyMap(AppUtil.jpaProperties());
factory.setDataSource(dataSource());
return factory; 
}
 @Bean
public DriverManagerDataSource dataSource(){ 
DriverManagerDataSource driverManagerDataSource = new 
DriverManagerDataSource();
driverManagerDataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
driverManagerDataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
driverManagerDataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
driverManagerDataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
 
return driverManagerDataSource;
}
 }
//Neo4j Setup
@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();
    }

}


On Tuesday, June 3, 2014 5:44:07 PM UTC+1, Michael Hunger wrote:
>
> @Transient is added by aspectj as far as I can remember for all fields 
> with @GraphProperty
>
> Perhaps you miss some of the ajc config?
>
> Michael
>
> Sent from mobile device
>
> Am 03.06.2014 um 18:30 schrieb [email protected] <javascript:>:
>
> 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] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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.

Reply via email to