Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
http://groups.google.com/group/kundera-discuss/subscribe
Apache License 2.0
903 stars 233 forks source link

em.CreateNativeQuery for Cassandra throws UnsupportedOperationException #514

Closed yeshvanthni closed 10 years ago

yeshvanthni commented 10 years ago

Queries like delete queries does not need the resultset to be translated to an Object so this api should still allow clients to invoke native CQL queries at their discretion.

Workaround: Call delete query with em.createNativeQuery("queryString",DummyClass.class);

mevivs commented 10 years ago

Yes, it's a constraint. Since Kundera supports multiple databases and em.createNativeQuery("queryString",DummyClass.class); would be required to explicitly map to specific client(whether Cassandra,MongoDB etc) in case of polyglot persistence.

However in case of single persistence unit it should be supported to default one. Will analyze and get it fixed with 2.10 release

-Vivek

mevivs commented 10 years ago

Moving for 2.11 release. For non polyglot cases , will asses and post an update.

-Vivek

mevivs commented 10 years ago

Support has been added for em.createNativeQuery(jpaQuery) and releasing with 2.10

em.createNativeQuery(select count(*) from person");

Alternative you may also use @NamedNativeQuery to define such native queries and use as follows:

@Entity
@Table(name = "person",)
@NamedNativeQuery(name="countQuery", query="select count(*) from person")
  public class PersonCassandra
{
......
}
em.createNamedQuery("countQuery");

Hope it helps.

-Vivek

mevivs commented 10 years ago

Support has been added and releasing with 2.10

-Vivek