An error occurred while generating the SQL statement Causedby: com. mysql. jdbc. exceptions. exceptions: failed; Hibernate: selecttopic0 _. idascol_0_0 _, topic0 _. titleascol_1_0 _, topic0 _. keyworda.
Select new Topic from 'mysql SQL statement generation error Caused by: com. mysql. jdbc. exceptions. jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; Hibernate: select topic0 _. id as col_0_0 _, topic0 _. title as col_1_0 _, topic0 _. keyword
Select new Topic from 'mysql SQL statement generation Error
Caused:
Com. mysql. jdbc. exceptions. jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax;
Hibernate:
Select
Topic0 _. id as col_0_0 _,
Topic0 _. title as col_1_0 _,
Topic0 _. keyword as col_2_0 _,
Topic0 _. status as col_3_0 _,
Topic0 _. recommend as col_4_0 _,
Topic0 _. publishName as col_5_0 _,
Topic0 _. publish_date as col_6_0 _,
Topic0 _. channel_name as col_7_0 _,
Topic0 _. author as col_8_0 _,
. As col_9_0 _
From
T_topic topic0 _
Inner join
T_attachment attachment1 _
On topic0 _. id = attachment1 _. topic_id
Where
1 = 1
And topic0 _. status = 1
And topic0 _. channel_id = 142 limit?
"Select new Topic (t. id, t. title, t. keyword, t. status, t. recommend, t. publishName, t. publishDate, t. channel_name, t. author, t. attachments )";
The constructor method is used to set the query.
However, when we encounter this onetoworkflow, it seems that we cannot do this.
When the Setattachments in the Topic is obtained by hibernate in the mysql database, it becomes an incorrect SQL statement.
Only select new Topic can be removed and directly written as from Topic.
Tell me who knows how to solve this problem.