JPA结构中MYSQL结构翻译错误
我有 100% 的 mysql 查询:
SELECT DISTINCT * FROM list_orders LEFT JOIN orders_translate where list_orders._id=orders_translate._order_id
query JPA String query = "SELECT t1 FROM ListOrders t1 LEFT JOIN t1.speakers e WHERE e._id = t1._id";
public class OrdersTranslate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "_id")
private Long id;
@Size(max = 50)
@Column(name = "_english_name")
private String englishName;
@Size(max = 50)
@Column(name = "_arabic_name")
private String arabicName;
@Size(max = 50)
@Column(name = "_russian_name")
private String russianName;
@Size(max = 50)
@Column(name = "_french_name")
private String frenchName;
@Basic(optional = false)
@NotNull
@Column(name = "_order_id")
private int order_id;
}
公共类 ListOrders 实现 Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "_id")
@SerializedName("_id")
private Integer id;
@Basic(optional = false)
@NotNull
@Column(name = "_number_id")
@SerializedName("_number_id")
private int numberId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "name")
@SerializedName("name")
private String name;
@OneToOne(cascade = CascadeType.ALL)
private List<OrdersTranslate> speakers;
}
我得到下一个错误:
[53, 54] FROM 子句具有'ListOrders t1 LEFT JOINN t1.oerders'和'e',它们没有用逗号分隔。[42, 53] 标识变量“t1.oerders”未遵循 Java 标识符的规则。[56, 56] 必须为范围变量声明提供标识变量。
JPA查询有什么问题?MySQL 查询工作正常!
长风秋雁
相关分类