com.impetus.kundera.query.QueryHandlerException: No entity found by the name: <EntityName>

萝らか妹 提交于 2019-12-02 16:19:07

问题


I am getting the following error when I run my application through SBT Console in Intellij IDEA 15, when the list page is opened which shows records from database:

com.impetus.kundera.query.QueryHandlerException: No entity found by the name: Employee
at com.impetus.kundera.query.KunderaQuery.initEntityClass(KunderaQuery.java:608) ~[kundera-core-3.2.jar:na]
at com.impetus.kundera.query.KunderaQuery.postParsingInit(KunderaQuery.java:540) ~[kundera-core-3.2.jar:na]
at com.impetus.kundera.query.QueryResolver.getQueryImplementation(QueryResolver.java:86) ~[kundera-core-3.2.jar:na]
at com.impetus.kundera.persistence.PersistenceDelegator.getQueryInstance(PersistenceDelegator.java:560) ~[kundera-core-3.2.jar:na]
at com.impetus.kundera.persistence.PersistenceDelegator.createQuery(PersistenceDelegator.java:521) ~[kundera-core-3.2.jar:na]
[error] m.p.EmployeeProcessImpl$ - No entity found by the name: Employee

The entity class is as follows:

package models.domains

import java.util.Date
import javax.persistence._
import java.util.UUID

@Entity
@Table(name = "employees", schema = "employeeexample@cassandra_employees")
class Employee {

  @Id
  var id: String = UUID.randomUUID.toString()

  @Column(name = "name")
  var name: String = "Employee"

  @Column(name = "address")
  var address: String = "Address"

  @Column(name = "dob")
  var dob: String = (new Date).toLocaleString()

  @Column(name = "joiningDate")
  var joiningDate: String = (new Date).toLocaleString()

  @Column(name = "designation")
  var designation: String = "Test"

}

case class EmployeeForm(id: String, name: String, address: String, dob: Date, joiningDate: Date, designation: String)

My persistence.xml file is as under:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    https://raw.github.com/impetus-opensource/Kundera/Kundera-2.0.4/kundera-core/src/test/resources/META-INF/persistence_2_0.xsd"
    version="2.0">
    <persistence-unit name="cassandra_employees">
        <provider>com.impetus.kundera.KunderaPersistence</provider>
        <properties>
            <property name="kundera.nodes" value="localhost" />
            <property name="kundera.port" value="9160" />
            <property name="kundera.keyspace" value="employeeexample" />
            <property name="kundera.dialect" value="cassandra" />
            <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
            <property name="kundera.pool.size.max.active" value="50" />
            <property name="kundera.pool.size.max.total" value="50" />
        </properties>
    </persistence-unit>
</persistence>

The example I am working with is taken from : http://blog.knoldus.com/2014/06/22/playing-kundera-cassandra/

My build.sbt is as under:

name := """playing-kundera-cassandra-knoldus"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(anorm, cache, ws)

resolvers ++= Seq(
    "Kundera" at "https://oss.sonatype.org/content/repositories/releases",
    "Riptano" at "http://mvn.riptano.com/content/repositories/public",
    "Kundera missing" at "http://kundera.googlecode.com/svn/maven2/maven-missing-resources",
    "Scale 7" at "https://github.com/s7/mvnrepo/raw/master"
)

libraryDependencies ++= Seq(
  "org.webjars"             %%  "webjars-play"              % "2.3.0",
  "org.webjars"             %   "bootstrap"                 % "3.1.1-1",
  "org.webjars"             %   "bootswatch-united"         % "3.1.1",
  "org.webjars"             %   "html5shiv"                 % "3.7.0",
  "org.webjars"             %   "respond"                   % "1.4.2",
  "com.impetus.kundera.core"    %   "kundera-core"    %   "3.2",
  "com.impetus.kundera.client"      %   "kundera-cassandra"         %   "3.2"
)

I am having Play! 2.4.6 framework with Cassandra 2.2.4. Please tell me if I have to make some version related change for Cassandra or CQL and that too in which file ? Please help me!!!


回答1:


Try to start your application by activator run command.

Also, add the below-mentioned property to create schema automatically.

<property name="kundera.ddl.auto.prepare" value="create" />

Read more about schema generation in Kundera.



来源:https://stackoverflow.com/questions/34327242/com-impetus-kundera-query-queryhandlerexception-no-entity-found-by-the-name-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!