打开jpa的问题

时间:2011-01-03 08:57:18

标签: jpa openjpa

我在使用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)

3 个答案:

答案 0 :(得分:8)

我刚刚解决了这样的错误。这个错误很容易让人误解。问题是我忘了将实体放入persistence.xml文件。

答案 1 :(得分:3)

我遇到了同样的问题。

信息不清楚!

解决了我的问题的原因正在实体对象及其 pk对象中实施equals()hashCode()

另请参阅classpersistence.xml是否 <}>

希望它有所帮助。

答案 2 :(得分:0)

我会猜测(我最好能在不看代码的情况下),你与另一个你没有用@ManyToOne,@ OneToMany或类似的东西注释的类有关系。