0

I am using Kundera with mongodb on a windows 7 box. I am trying to use int data type. But I am getting the following error.

Exception in thread "main" com.impetus.kundera.configure.schema.SchemaGenerationException: Persistence unit for class : int is not loaded
    at com.impetus.kundera.configure.SchemaConfiguration.parseRelations(SchemaConfiguration.java:262)
    at com.impetus.kundera.configure.SchemaConfiguration.configure(SchemaConfiguration.java:151)
    at com.impetus.kundera.configure.ClientMetadataBuilder.buildClientFactoryMetadata(ClientMetadataBuilder.java:48)
    at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configureClientFactories(EntityManagerFactoryImpl.java:404)
    at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configure(EntityManagerFactoryImpl.java:157)
    at com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:131)
    at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:85)
    at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
    at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
    at com.atomconnect.App.insertIntoMongo(App.java:37)
    at com.atomconnect.App.main(App.java:53)

My entity object has the following fields

@Id
@Column(name="MESSAGE_ID")
private String messageId;

@Column(name = "SUBJECT")
private String subject;

@Column(name = "BODY")
private String body;

@Column(name = "zipcode")
private int zipcode;

@Embedded
private Contact from;

My persistence.xml looks like below

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="2.0">
<persistence-unit name="ac">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <properties>
        <property name="kundera.nodes" value="localhost" />
        <property name="kundera.port" value="12345" />
        <property name="kundera.keyspace" value="test" />
        <property name="kundera.dialect" value="mongodb" />
        <property name="kundera.client.lookup.class" value="com.impetus.client.mongodb.MongoDBClientFactory" />
        <property name="" value="datastore_mongo.jar"/>
       <!--  <property name="kundera.cache.provider.class" value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
        <property name="kundera.cache.config.resource" value="/ehcache-test.xml" /> -->
    </properties>
    <jar-file>target/test.jar</jar-file>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
 </persistence-unit>
</persistence>

I wasted 2 days around this but not able to get the solution. Any help would be appreciated

4

2 回答 2

0

我有一个类,我已经为从未使用过的 int 数据类型声明了一对一的映射注释。

这应该不会导致任何问题,但 kundera 通过反射填充元数据的方式是问题所在。

于 2014-07-07T05:14:29.177 回答
0

你可以尝试删除

属性名称="" 值="datastore_mongo.jar"

并分享 test.jar 实体代码?另外,您使用的是哪个版本的昆德拉?

于 2014-06-25T17:02:02.033 回答