P
P
pinkerest2021-04-11 09:36:07
Java
pinkerest, 2021-04-11 09:36:07

Development of Java applications that interact with the database through Hibernate. Jib, error in deleting string columns, what's the problem?

The code implements connections with the database table, everything works fine except for deleting String columns ( deleting the id (integer) column occurs without problems. Please help me figure out what the problem is.
Code referred to by the errors:
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
Error:
Apr. 11, 2021 9:17:45 AM org.hibernate.hql.internal.ast.ErrorTracker reportError
ERROR: line 1:51: unexpected token: null
Apr 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
) .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
) .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
) 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
) .QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:155)
at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:604)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:716
)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BorLaze, 2021-04-11
@pinkerest

DELETE students.hibernate.bsuir.Shop WHERE name =

First, FROM is omitted.
Second, where is .setParameter("name", name) supposed to put this name?
Try like this:
DELETE FROM Shop WHERE name = :name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question