impetus-opensource/Kundera — Issue #45: I have a problem using kundera-rdbms.
Author: yo2dh
Created: 2012-03-06 08:20:47+00:00
State: open

Hi.

I have a problem using kundera-rdbms 2.0.5.

persistence.xml

com.impetus.kundera.KunderaPersistence
com.testkun.kunderatest.Person
true

Person.java

package com.testkun.kunderatest;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "person" , schema = "test")
public class Person
{
@Id
@Column (name="Name", length = 20)
String	Name;

@Column (name="Text", length = 45)
String	Text;

public String getName ()
{
return Name;
}

public void setName ( String name )
{
Name = name;
}

public String getText ()
{
return Text;
}

public void setText ( String text )
{
Text = text;
}
}

App.java

package com.testkun.kunderatest;

import java.util.Date;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class App
{
public static void main( String[] args )
{

Person person = new Person();
person.setName ( "Test" );
person.setText ( "Test" );

EntityManagerFactory emf = Persistence.createEntityManagerFactory ( "mysqlPU" );
EntityManager em = emf.createEntityManager();

em.persist ( person );

em.close();
emf.close();
}
}

And then I got :

2012-03-06 16:58:41,030 [INFO ] [main] com.impetus.kundera.KunderaPersistence - Loading Core
2012-03-06 16:58:41,034 [INFO ] [main] com.impetus.kundera.loader.CoreLoader - Loading factories ...
2012-03-06 16:58:41,044 [INFO ] [main] com.impetus.kundera.KunderaPersistence - Loading Application MetaData and Initializing Client(s) For Persistence Unit(s) mysqlPU
2012-03-06 16:58:41,075 [INFO ] [main] com.impetus.kundera.loader.PersistenceUnitLoader - Looking up for persistence unit: mysqlPU
2012-03-06 16:58:42,078 [INFO ] [main] com.impetus.kundera.persistence.EntityManagerFactoryImpl - Loading Client(s) For Persistence Unit(s) mysqlPU
2012-03-06 16:58:42,088 [INFO ] [main] com.impetus.kundera.loader.GenericClientFactory - Loading client metadata for persistence unit : mysqlPU
2012-03-06 16:58:42,088 [INFO ] [main] com.impetus.kundera.loader.GenericClientFactory - Initializing client for persistence unit : mysqlPU
2012-03-06 16:58:42,134 [INFO ] [main] com.impetus.kundera.loader.GenericClientFactory - Constructing pool for persistence unit : mysqlPU
2012-03-06 16:58:42,135 [INFO ] [main] com.impetus.kundera.persistence.EntityManagerFactoryImpl - EntityManagerFactory created for persistence unit : mysqlPU
2012-03-06 16:58:42,146 [WARN ] [main] com.impetus.kundera.metadata.KunderaMetadataManager - Something is terribly wrong, No Entity metadata found for the class class com.testkun.kunderatest.Person. If your entity is for RDBMS, make sure you put fully qualified entity class name under tag in persistence.xml for RDBMS persistence unit. Returning null value.
java.lang.NullPointerException
at com.impetus.kundera.persistence.event.EntityEventDispatcher.fireEventListeners(EntityEventDispatcher.java:54)
at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:587)
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:152)
at com.testkun.kunderatest.App.main(App.java:38)
Exception in thread "main" javax.persistence.PersistenceException: java.lang.NullPointerException
at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:604)
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:152)
at com.testkun.kunderatest.App.main(App.java:38)
Caused by: java.lang.NullPointerException
at com.impetus.kundera.persistence.event.EntityEventDispatcher.fireEventListeners(EntityEventDispatcher.java:54)
at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:587)
... 2 more

Did I have a mistake?

Please, let me know.