2

使用 open jpa 时,我在控制台上收到以下错误。可能的原因是什么?我无法发布代码,因为它违反了我的公司政策。

[12/31/10 14:54:13:279 GMT+05:30] 00000063 MetaData      W   CWWJP9991W: openjpa.MetaData: Warn: OpenJPA cannot map field "abc.xyz" efficiently.  It is of an unsupported type. The field value will be serialized to a BLOB by default.
[12/31/10 14:54:13:295 GMT+05:30] 00000063 MetaData      W   CWWJP9991W: openjpa.MetaData: Warn: The class "pqr.xyz" listed in the openjpa.MetaDataFactory configuration property could not be loaded; ignoring.
[12/31/10 14:54:13:295 GMT+05:30] 00000063 MetaData      W   CWWJP9991W: openjpa.MetaData: Warn: OpenJPA cannot map field "pqr.xyz" efficiently.  It is of an unsupported type. The field value will be serialized to a BLOB by default.

 Failed to create Bundle in DB:
                                 <openjpa-1.2.2-SNAPSHOT-r422266:778978M-OPENJPA-975 fatal user error> org.apache.openjpa.persistence.ArgumentException: Field "abc.xyz" cannot declare that it is mapped by another field. Its mapping strategy (org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy) does not support mapping by another field.
    at org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy.assertNotMappedBy(AbstractFieldStrategy.java:59)
    at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.map(HandlerFieldStrategy.java:71)
    at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:121)
    at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
    at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:454)
    at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:419)
    at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:879)
    at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:339)
    at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:662)
    at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:549)
    at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
    at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:363)
    at org.apache.openjpa.kernel.QueryImpl.classForName(QueryImpl.java:1569)
    at org.apache.openjpa.kernel.ExpressionStoreQuery$1.classForName(ExpressionStoreQuery.java:108)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:168)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:139)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
    at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
    at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
    at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:153)
    at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
    at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
    at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
    at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
    at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
    at com.xyz.ws.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:105)
    at com.xyz.ws.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:37)
    at com.xyz.ws.jpa.management.JPATxEmInvocation.createNamedQuery(JPATxEmInvocation.java:116)
    at com.xyz.ws.jpa.management.JPAEntityManager.createNamedQuery(JPAEntityManager.java:302)
4

3 回答 3

9

我刚刚解决了这样的错误。这个错误非常具有误导性。问题是我忘记将实体放入persistence.xml文件中。

于 2012-08-28T04:39:23.837 回答
3

我遇到了同样的问题。

消息不清楚!

解决我的问题的是在实体对象及其pk 对象中实现equals()和。hashCode()

另请查看是否在class内部声明persistence.xml

希望它可以帮助某人。

于 2014-06-24T15:50:31.250 回答
0

我会猜测(最好我可以不看代码)你与另一个你没有用@ManyToOne、@OneToMany 或类似注释注释的类有关系。

于 2011-01-04T10:41:07.837 回答