Closed mevivs closed 10 years ago
I have a workaround for my apps (no need to mess with Kundera code):
<dependency>
<groupId>com.impetus.client</groupId>
<artifactId>kundera-cassandra</artifactId>
<version>2.8.1</version>
<exclusions>
<exclusion>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
But it seems Kundera is not compatible with Java EE 7 persistence API, which IIRC is JPA 2.1.
I get the following error with Kundera 2.8.1 on a Glassfish 4.0-b04 nightly build:
java.lang.AbstractMethodError
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:197)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:455)
at com.github.pires.polyglot.dao.AbstractNoSQLDao.findAll(AbstractNoSQLDao.java:62)
Here follows my AbstractDao
class:
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
/**
* Abstract Data-Access Object class to be implemented by all NoSQL DAO's.
*/
public abstract class AbstractNoSQLDao<T> {
protected Class<T> entityClass;
@PersistenceContext(unitName = "NOSQL_PU",
type = PersistenceContextType.TRANSACTION)
private EntityManager em;
public AbstractNoSQLDao(Class<T> entityClass) {
this.entityClass = entityClass;
}
public EntityManager getEntityManager() {
return this.em;
}
public void setEntityManager(EntityManager em) {
this.em = em;
}
public void create(T entity) {
getEntityManager().persist(entity);
}
public T update(T entity) {
return getEntityManager().merge(entity);
}
public void remove(Object entityId) {
T entity = find(entityId);
if (entity != null)
getEntityManager().remove(entity);
}
public T find(Object id) {
return getEntityManager().find(entityClass, id);
}
public List<T> findAll() {
String cql = "select t from " + entityClass.getSimpleName() + " t";
return getEntityManager().createQuery(cql).getResultList();
}
public int count() {
List<T> results = findAll();
return results == null ? 0 : results.size();
}
}
``
Changes checked-in. Kundera current trunk is deployable over jee7 containers. Work to make Kundera JPA 2.1 complaint is in progress. https://github.com/impetus-opensource/Kundera/issues/457
Duplicate. Please track with #457.
From: kundera-discuss@googlegroups.com [mailto:kundera-discuss@googlegroups.com] On Behalf Of Sasikumar Vijayakumar Sent: Wednesday, November 13, 2013 3:50 AM To: kundera-discuss@googlegroups.com Subject: {kundera-discuss} Re: Kundera 2.8 released
Hi Vivek and Kundera team:
Thanks for the 2.8 release. We are actively developing with Kundera against MongoDB. However, the problem we see with 2.8 is regarding dependency to javax.persistence. As you may already know, there is no more javax.persistence artifact and just javaee-api. Please rectify this as our internal maven repositories are failing to resolve dependency to javax.persistence 2.0. We look forward to an early resolution on this to benefit the wider community.
dependency
should be
Thanks -Sasi