2017-12-26 35 views
0

DataNucleus와 JDO를 사용합니다. 영속성 프로세스 동안 "테이블"에 대한 스키마를 생성하기 위해 나는 datanucleus.schema.autoCreateAll=true을 사용하여 DataNucleus에게 스키마 자동 생성을 지시합니다. 테이블에 enty를 만들면 모델 결과에 필드를 추가하려는 시도가 org.neo4j.graphdb.NotFoundException: NODE[68] has no property with propertyKey="newFieldName"이됩니다.Neo4j 데이터베이스에 속성을 추가하는 방법 항목이 포함 된 테이블 (DataNucleus)?

이미 항목이 들어있는 표에 속성을 변경하거나 추가하는 가장 좋은 방법은 무엇입니까?

이것은 스택 추적입니다.

2017-12-27 13:46:08.509 [qtp1955990522-68] Query - JDOQL Query : Executing "SELECT FROM com.hope.tub.neo4j.jdo.model.Product WHERE name.equals(value) PARAMETERS String value" ... 
2017-12-27 13:46:08.509 [qtp1955990522-68] Native - Retrieving objects of type com.hope.tub.neo4j.jdo.model.Product using Cypher query : START this=node:DN_TYPES(class="com.hope.tub.neo4j.jdo.model.Product") RETURN this 
[INFO ] 2017-12-27 13:46:08.537 [qtp1955990522-68] Query - Reading in results for query "SELECT FROM com.hope.tub.neo4j.jdo.model.Product WHERE name.equals(value) PARAMETERS String value" since the connection used is closing/committing 
2017-12-27 13:46:08.539 [qtp1955990522-68] Cache - Object with id "com.hope.tub.neo4j.jdo.model.Product:11" not found in Level 1 cache 
2017-12-27 13:46:08.540 [qtp1955990522-68] Cache - Object "[email protected]" (id="com.hope.tub.neo4j.jdo.model.Product:11") added to Level 1 cache (loadedFlags="[NNNYNNNNNNN]") 
2017-12-27 13:46:08.567 [qtp1955990522-68] Connection - Managed connection org.data[email protected]7e678a93 [[email protected], commitOnRelease=true, closeOnRelease=true, closeOnTxnEnd=false] is committing 
2017-12-27 13:46:08.567 [qtp1955990522-68] Connection - Managed connection org.data[email protected]7e678a93 [[email protected], commitOnRelease=true, closeOnRelease=true, closeOnTxnEnd=false] committed connection 
2017-12-27 13:46:08.568 [qtp1955990522-68] Persistence - Disconnecting [email protected] from StateManager[[email protected], lifecycle=HOLLOW] 
2017-12-27 13:46:08.568 [qtp1955990522-68] Cache - Level 1 Cache cleared 
2017-12-27 13:46:08.568 [qtp1955990522-68] Persistence - ExecutionContext CLOSED "[email protected]" 
2017-12-27 13:46:08.568 [qtp1955990522-68] Transaction - Transaction rolling back for ExecutionContext [email protected] 
2017-12-27 13:46:08.568 [qtp1955990522-68] Transaction - Rolling back [DataNucleus Transaction, ID=1608044257-5, enlisted resources=[]] 
2017-12-27 13:46:08.568 [qtp1955990522-68] Transaction - Transaction rolled back in 0 ms 
2017-12-27 13:46:08.569 [qtp1955990522-68] Persistence - ExecutionContext CLOSED "[email protected]" 
Dec 27, 2017 1:46:08 PM com.hope.tub.servlets.TuCreateServlet doPost 
SEVERE: null 
org.neo4j.graphdb.NotFoundException: NODE[11] has no property with propertyKey="creatorID". 
at org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:479) 
at  org.datanucleus.store.neo4j.fieldmanager.FetchFieldManager.fetchLongField(FetchFieldManager.java:157) 
at org.datanucleus.state.StateManagerImpl.replacingLongField(StateManagerImpl.java:1912) 
at com.hope.tub.neo4j.jdo.model.Product.dnReplaceField(Product.java) 
at com.hope.tub.neo4j.jdo.model.Product.dnReplaceFields(Product.java) 
at org.datanucleus.state.StateManagerImpl.replaceFields(StateManagerImpl.java:4286) 
at org.datanucleus.state.StateManagerImpl.replaceFields(StateManagerImpl.java:4311) 
at org.datanucleus.store.neo4j.Neo4jUtils$1.fetchFields(Neo4jUtils.java:605) 
at org.datanucleus.state.StateManagerImpl.loadFieldValues(StateManagerImpl.java:3719) 
at org.datanucleus.store.neo4j.Neo4jUtils.getObjectUsingApplicationIdForDBObject(Neo4jUtils.java:601) 
at org.datanucleus.store.neo4j.Neo4jUtils.getObjectForPropertyContainer(Neo4jUtils.java:565) 
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.getResultFromMapRow(LazyLoadQueryResult.java:153) 
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.closingConnection(LazyLoadQueryResult.java:136) 
at org.datanucleus.store.query.AbstractQueryResult.disconnect(AbstractQueryResult.java:105) 
at org.datanucleus.store.neo4j.query.JDOQLQuery.performExecute(JDOQLQuery.java:291) 
at org.datanucleus.store.query.Query.executeQuery(Query.java:1966) 
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1855) 
at org.datanucleus.api.jdo.JDOQuery.executeInternal(JDOQuery.java:433) 
at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:276) 
at com.hope.tub.neo4j.jdo.services.impl.ProductNeo4jServiceImpl.findByName(ProductNeo4jServiceImpl.java:76) 
at com.hope.tub.neo4j.jdo.services.impl.ProductNeo4jServiceImpl.save(ProductNeo4jServiceImpl.java:90) 
at com.hope.tub.neo4j.jdo.services.impl.ProductNeo4jServiceImpl.save(ProductNeo4jServiceImpl.java:24) 
at com.hope.tub.access.beans.ProductBean.createProduct(ProductBean.java:135) 
at com.hope.tub.servlets.TuCreateServlet.createProduct(TuCreateServlet.java:107) 
at com.hope.tub.servlets.TuCreateServlet.doPost(TuCreateServlet.java:57) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772) 
at com.hope.tub.filters.ValidateJsonAntiForgeryTokenFilter.doFilter(ValidateJsonAntiForgeryTokenFilter.java:254) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751) 
at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFil[INFO ] 2017-12-27 13:46:08.571 [qtp1955990522-68]/- ValidateJsonAntiForgeryTokenFilter:DoAfterProcessing 
ter(ServletHandler.java:1759) 
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) 
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) 
at org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:1180) 
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java) 
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) 
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) 
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) 
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) 
at org.eclipse.jetty.server.Server.handle(Server.java:534) 
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) 
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:267) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) 
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) 
at java.lang.Thread.run(Thread.java:745) 
Caused by: org.neo4j.kernel.api.exceptions.PropertyNotFoundException: NODE[11] has no property with propertyKeyId=29. 
at org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:471) 
... 50 more 

초기 모델 :

@PersistenceCapable(identityType = IdentityType.APPLICATION, cacheable = "false", detachable = "true") 
public class Product implements Serializable { 

private static final long serialVersionUID = 8269335445554701873L; 

@PrimaryKey 
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) 
long id; 
@Persistent 
private String name = null; 
... 

다음과 같은 새로운 속성을 추가하려고 시도하면, 위의 스택 추적을 재생합니다.

... 
@PrimaryKey 
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) 
long id; 
@Persistent 
private String name = null; 
@Persistent 
private long creatorID; 
... 
+0

예외에 대한 스택 추적을 게시하지 않는 이유는 무엇입니까? 예외가 없으면 예외가 있습니다. – DN1

+0

@ DN1 스택 추적 및 추가 정보를 추가했습니다. 감사. – Hopecee

답변

0

누락 된 (문자열이 아닌) 열은 현재 제공되지 않습니다. 즉, Neo4j 데이터베이스에 저장된 객체가 객체를 검색하는 데 사용 된 모델과 일치한다고 가정합니다.

GitHub에서 수정되었습니다. https://github.com/datanucleus/datanucleus-neo4j/issues/32

+0

감사합니다. @andyjefferson 당신이 잘하고 있습니다. – Hopecee