本文介绍了com.impetus.kundera.query.QueryHandlerException:未找到名称为< EntityName>的实体.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开列表页面显示来自数据库的记录时,通过Intellij IDEA 15中的SBT控制台运行应用程序时出现以下错误:

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

实体类如下:

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)

我的persistence.xml文件如下:

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>

我正在使用的示例取自: http://blog.knoldus.com/2014/06/22/玩kundera-cassandra/

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

我的build.sbt如下:

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"
)

我正在玩游戏! 2.4.6使用Cassandra 2.2.4的框架.请告诉我是否需要对Cassandra或CQL进行一些与版本相关的更改,并且还要在哪个文件中进行更改?请帮助我!

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!!!

推荐答案

尝试通过 activator run 命令启动您的应用程序.

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" />

了解有关昆德拉(Kundera)中模式生成的更多信息.

Read more about schema generation in Kundera.

这篇关于com.impetus.kundera.query.QueryHandlerException:未找到名称为&lt; EntityName&gt;的实体.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 16:46