Syntax error in SQL statement - H2 error 42001

32,457

I had the same issue:

My Entity looked like this:

@Entity
public class ShopCommentRating {

@NotNull
private Boolean like;

}

The resulting Query contained a [*]

To remove the error i had to change the field name to sth. like this:

@Entity
public class ShopCommentRating {

@NotNull
private Boolean commentLike;

}

'lower case camel case' name

Share:
32,457
SnoBro
Author by

SnoBro

Updated on July 16, 2022

Comments

  • SnoBro
    SnoBro almost 2 years

    Upon running this SQL statement:

    select TimeInterval, 
           ((((Timer*60)/1.0)*100)/((10.0*60)/60.0)) as 'Throughput-run_1_8_11' 
    from StatExternalData, StatisticDefinition 
    where StatisticDefinition.ID=StatExternalData.StatDefId 
          and StatisticName='PSI_CompTran_Successful_Cnt'  
    order by TimeInterval asc
    

    I get this error:

    "select TimeInterval, ((((Timer*60)/1.0)*100)/((10.0*60)/60.0)) as 'Throughput-run_1_8_11'[*] from StatExternalData, StatisticDefinition where StatisticDefinition.ID=StatExternalData.StatDefId and StatisticName='PSI_CompTran_Successful_Cnt'  order by TimeInterval asc"; 
    expected "identifier"; [42001-185]
    

    I've figured out that the [*] is indicating what part of the statement is incorrect and that H2 error code 42001 signifies an invalid SQL statement, but I've been banging my head on the wall for weeks trying to figure out what the problem is, anyone have an idea?