hibernate - Could not determine type for: java.util.Set for Jpa/Neo4J Cross Store Entity -
i have jpa entity acts neo4j cross store. of fields in entity saved mysql database except collection 'followers', stored in neo4j. problem collection 'followers'. throws exception "hibernate mappingexception: not determine type for: java.util.set". quick search yields bunch of jpa related solutions (e.g. adding onetomany annotation field etc) assume not relevant in case because collection saved in neo4j not mysql.
stacktrace caused by: org.hibernate.mappingexception: not determine type for: java.util.set, @ table: game, columns: [org.hibernate.mapping.column(followers)] @ org.hibernate.mapping.simplevalue.gettype(simplevalue.java:314) @ org.hibernate.mapping.simplevalue.isvalid(simplevalue.java:292) @ org.hibernate.mapping.property.isvalid(property.java:239) @ org.hibernate.mapping.persistentclass.validate(persistentclass.java:469) @ org.hibernate.mapping.rootclass.validate(rootclass.java:270) @ org.hibernate.cfg.configuration.validate(configuration.java:1303) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1761) @ org.hibernate.ejb.entitymanagerfactoryimpl.<init>(entitymanagerfactoryimpl.java:96) @ 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 "..."; } } //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.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 crossstoreneo4jconfiguration{ @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(); } }
i have uploaded project simulate following problem. download , run accounttester.class see exception - http://filebin.ca/1pgiysebag4q/crossstore.zip.
Comments
Post a Comment