Using Eclipselink/JPA in my StreamSink
776905Dec 1 2010 — edited Feb 1 2011Hi,
I am trying to persist my events in the database using Eclipselink. I got my persistence.xml inside the META-INF folder and my event class is fully annotated with JPA annotations and I have the code below in my StreamSink:
public void onInsertEvent(Object event) throws EventRejectedException {
if (event instanceof Nsnincat) {
if (em == null) {
em = Persistence.createEntityManagerFactory("JPA").createEntityManager();
}
em.getTransaction().begin();
em.persist((Nsnincat)event);
em.getTransaction().commit();
} else {
System.err.println("@@@@@@@@@@@ object not instanceof Nsnincat!!!!");
}
}
However, I am getting the exception below when I deployed my EPN in the CEP server:
<Dec 1, 2010 1:24:47 PM SGT> <Warning> <Ede> <BEA-000000> <Exception for 'com.nsn.cvo.jpa.Nsnincat@5f50d1f' raised by listener = com.nsn.cvo.eventsink.DbSink@86301e3
javax.persistence.PersistenceException: No Persistence provider for EntityManager named JPA
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.nsn.cvo.eventsink.DbSink.onInsertEvent(DbSink.java:19)
I also already put the Eclipselink and JPA jars inside the server(C:\Oracle\Middleware\oracle_cep_11.1.1.4\user_projects\domains\ocep_domain1\defaultserver\modules\ext in my case) and set it in the "Oracle CEP Application Library Path" in my Eclipse.
Can anybody help me why I am getting this exception. It seems to me that the CEP server cannot detect the persistence.xml. Any help will be greatly appreciated.
Thanks,
Aurelio Jr. Pascual