Sample Project Will Help Beginers

56 views
Skip to first unread message

raghunath n

unread,
Feb 27, 2014, 2:01:56 AM2/27/14
to simp...@googlegroups.com
Hi , I'm exploring SimpleJPA. I could not be able to find a simple project. I tried to setup following program. But I'm getting following exception . Please help.


import com.spaceprogram.simplejpa.EntityManagerFactoryImpl;
import javax.persistence.EntityManager;
/**
 *
 * @author visum_000
 */
public class SampleEntity {
    // Create EntityManagerFactory. This should be a global object that you reuse.
    private static EntityManagerFactoryImpl factory = 
   new EntityManagerFactoryImpl("doma", null);
    public static void main(String[] args) {
EntityManager em = factory.createEntityManager();
MyTestObject ob = new MyTestObject();
ob.setName("Scooby doo");
em.persist(ob);
em.close();
factory.close();
    }
    
}

Feb 27, 2014 12:16:08 PM com.spaceprogram.simplejpa.EntityManagerFactoryImpl loadProps2
INFO: Properties loaded from [/simplejpa.properties].
java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at com.spaceprogram.simplejpa.EntityManagerFactoryImpl.init(EntityManagerFactoryImpl.java:312)
at com.spaceprogram.simplejpa.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:196)
at com.spaceprogram.simplejpa.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:166)
at com.faternityglobal.aws.simpledb.util.db.SampleEntity.<clinit>(SampleEntity.java:18)
Exception in thread "main" [INFO] NETBEANS-ExecEvent:{"mojo":{"id":"org.codehaus.mojo:exec-maven-plugin:1.2.1","source":"CLI","execId":"default-cli","goal":"exec"},"exc":{"msg":"Q29tbWFuZCBleGVjdXRpb24gZmFpbGVkLg=="},"type":"MojoFailed"}
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.217s
 

Reply all
Reply to author
Forward
0 new messages