我有一个这样的实体:
@Entity
@Table(name = "QUESTION_GROUP_TEXT")
@NamedQueries({
@NamedQuery(
name = EntityUtils.NamedQuery.UPDATE_QUESTION_GROUP_TEXT,
query = "UPDATE QuestionGroupText T SET T.localizedText.content = :content WHERE T.generatedId = :generatedId")
})
public class QuestionGroupText implements Serializable {
@Column(name = "GENERATED_ID", nullable = false, unique = true)
private String generatedId = generateId();
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "LOCALIZED_TEXT_ID", nullable = false)
private LocalizedText localizedText;
//Getters and setters
}
此查询:UPDATE QuestionGroupText T SET T.localizedText.content = :content WHERE T.generatedId = :generatedId
不起作用,它会抛出:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set CONTENT='Question Label' where GENERATED_ID='AD78F9B5E2A146D9AB9D94096DA835B' at line 1
查询的这一部分一定有问题:T.localizedText.content
,有什么办法可以改变它来使它工作吗?