Я пытаюсь получить доступ к локальной базе данных MYSQL, в которой есть таблица с именем default, содержащая столбцы name, id и help.Я использую Play Framework с JPA, Ebean.
Это сообщение об ошибке, которое я получаю.
[warn] o.h.e.j.s.SqlExceptionHelper - SQL Error: 1064, SQLState: 42000
[error] o.h.e.j.s.SqlExceptionHelper - You have an error in your
SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'default language0_' at line 1
....
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2167)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1930)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1892)
at org.hibernate.loader.Loader.doQuery(Loader.java:937)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340)
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default language0_' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2167)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1930)
Этот вызов сделан для перечисления всех записей:
private Stream<Language> list(EntityManager em) {
List<Language> persons = em.createQuery("select p from Language p").getResultList();
return persons.stream();
}
и вот модель, которую я использую: комплектные модели;
import javax.persistence.*;
@Entity
@Table(name="default")
public class Language {
@Id
@Column(name="`id`")
@GeneratedValue(strategy=GenerationType.AUTO)
public Long id;
@Column(name="`text`")
public String text;
@Column(name="`help`")
public String help;
}