org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]

Hibernate JIRA | Mathias Bogaert | 1 decade ago
  1. 0

    Exception in thread "Thread-134" org.springframework.orm.hibernate3.HibernateQueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]; nested exception is org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID] org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID] at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:83) at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108) at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:178) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:154) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88) at nl.nutsmaas.marvin.domain.persistence.hibernate.HibernateCableModemDao.archiveSamples(HibernateCableModemDao.java:195) Code: String hqlDelete = "delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID"; int deletedEntities = getSessionFactory().getCurrentSession().createQuery( hqlDelete ) .setLong( ":CM_ID", cableModem.getId()).executeUpdate(); log.info("Deleted " + deletedEntities + " unarchived cable modem samples");

    Hibernate JIRA | 1 decade ago | Mathias Bogaert
    org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]
  2. 0

    Exception in thread "Thread-134" org.springframework.orm.hibernate3.HibernateQueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]; nested exception is org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID] org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID] at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:83) at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108) at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:178) at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:154) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88) at nl.nutsmaas.marvin.domain.persistence.hibernate.HibernateCableModemDao.archiveSamples(HibernateCableModemDao.java:195) Code: String hqlDelete = "delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID"; int deletedEntities = getSessionFactory().getCurrentSession().createQuery( hqlDelete ) .setLong( ":CM_ID", cableModem.getId()).executeUpdate(); log.info("Deleted " + deletedEntities + " unarchived cable modem samples");

    Hibernate JIRA | 1 decade ago | Mathias Bogaert
    org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]
  3. 0

    OR 3.0.1 Report Editing

    oreports | 9 years ago | diaben
    org.hibernate.QueryException: query must begin with SELECT or FROM: DELETE \[DELETE org.efs.openreports.objects.ORTag orTag where orTag.objectId = ? and orTag.objectClass = ? and orTag.tagType = ? \]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Query syntax error when bulk-deleting in Hibernate

    Stack Overflow | 7 years ago | Tadeusz Kopec
    org.hibernate.QueryException: query must begin with SELECT or FROM: delete [ delete from pl.com.bms.avaro.staticData.model.NewCalendarDay ]
  6. 0

    how to update the table in java using hibernate without using hql and sql

    Stack Overflow | 3 years ago | user3205372
    org.hibernate.QueryException: query must begin with SELECT or FROM: update [update clinic.entity.DocDetail set DocName = :studentName where Id = :studentId]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.QueryException

      query must begin with SELECT or FROM: delete [delete from UnarchivedSample u where u.CABLE_MODEM_SAMPLE_ID = :CM_ID]

      at org.hibernate.hql.classic.ClauseParser.token()
    2. Hibernate
      AbstractSessionImpl.createQuery
      1. org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:83)
      2. org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108)
      3. org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
      4. org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:178)
      5. org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:154)
      6. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
      7. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
      8. org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
      9. org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
      10. org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
      10 frames
    3. nl.nutsmaas.marvin
      HibernateCableModemDao.archiveSamples
      1. nl.nutsmaas.marvin.domain.persistence.hibernate.HibernateCableModemDao.archiveSamples(HibernateCableModemDao.java:195)
      1 frame