@pinkerest

Разработка Java приложений, взаимодействующих с БД через Hibernate. Jib, ошибка в удалении string-столбцов, в чём проблема?

В коде реализовано соединений с таблицей БД, всё хорошо работает кроме удаления String-столбцов ( при этом удаление столбца id (integer) происходит без проблем. Пожалуйста, помогите разобраться, в чем проблема.
Код на который ссылаются ошибки:
BXcOK8Wt9oA.jpg?size=1280x720&quality=96&sign=3b5bd9d54f47050e61683f891a47f5c1&type=album
QgbJEvWxjD8.jpg?size=1280x720&quality=96&sign=4f2f6445490b6fc04c8193b71f3e6383&type=album

aHzrBL7kF70.jpg?size=1280x720&quality=96&sign=6795982d81e717f5fe4c0432897261cd&type=album
P8UHwKKgOug.jpg?size=1280x720&quality=96&sign=2f0be0432e384a5d922034c1e5d92a69&type=album
fvlwjT_KWPY.jpg?size=1280x720&quality=96&sign=93fd58fdb714b9f695dfe71db08b1eb3&type=album
Ошибка:
апр. 11, 2021 9:17:45 AM org.hibernate.hql.internal.ast.ErrorTracker reportError
ERROR: line 1:51: unexpected token: null
апр. 11, 2021 9:17:45 AM org.hibernate.hql.internal.ast.ErrorTracker reportError
ERROR: line 1:51: unexpected token: null
line 1:51: unexpected token: null
at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3408)
at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3273)
at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2930)
at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:615)
at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2697)
at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2653)
at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2522)
at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2438)
at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2403)
at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2116)
at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1894)
at org.hibernate.hql.internal.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:498)
at org.hibernate.hql.internal.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:289)
at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:187)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:290)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:189)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:144)
at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:113)
at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:73)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:155)
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:604)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:716)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:113)
at students.hibernate.bsuir.Remove.removeName(Remove.java:50)
at students.hibernate.bsuir.Remove.removeName(Remove.java:25)
at students.hibernate.bsuir.ShopRunner.main(ShopRunner.java:60)

Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: null near line 1, column 51 [DELETE students.hibernate.bsuir.Shop WHERE name = ]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:725)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:113)
at students.hibernate.bsuir.Remove.removeName(Remove.java:50)
at students.hibernate.bsuir.Remove.removeName(Remove.java:25)
at students.hibernate.bsuir.ShopRunner.main(ShopRunner.java:60)
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: null near line 1, column 51 [DELETE students.hibernate.bsuir.Shop WHERE name = ]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
at org.hibernate.hql.internal.ast.ErrorTracker.throwQueryException(ErrorTracker.java:93)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:297)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:189)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:144)
at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:113)
at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:73)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:155)
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:604)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:716)
... 4 more
  • Вопрос задан
  • 54 просмотра
Решения вопроса 1
BorLaze
@BorLaze
Java developer
DELETE students.hibernate.bsuir.Shop WHERE name =


Во-первых, пропущен FROM.
Во-вторых, .setParameter("name", name) куда это name должен поместить?

Попробуй так:
DELETE FROM Shop WHERE name = :name
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы