i have tried several combinations from
EJB spec and I cannot get any JOIN working:
Below is a class:
@Entity
@Table(name="LINEITEM")
@NamedQuery(name="findLineItemByProductAndOrder",
queryString="SELECT l FROM LineItem as l INNER JOIN l.product as p WHERE p.sku =

roductId AND l.orderId =

rderId")
public class LineItem implements Serializable {
private Integer orderId;
private Integer quantity;
private Integer total;
private Product product;
@Id
@Column(name="ORDER_ID", primaryKey=true)
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
@Id
@ManyToOne(fetch=FetchType.EAGER )
@JoinColumn(name="PRODUCT_ID")
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
@Column(name="QUANTITY")
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
@Column(name="AMOUNT")
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
}
When I execute the JOIN, I get:
05/07/25 15:42:39 Caused by: Exception [TOPLINK-0] (Oracle TopLink - 10g release 3 (10.1.3.0) (Build 050221Dev)): oracle.toplink.exceptions.EJBQLException
Exception Description: Syntax Recognition Problem parsing the EJBQL [SELECT DISTINCT l.total FROM LineItem as l JOIN l.product as p WHERE p.sku =

roductId AND l.orderId =

rderId]. The parser returned the following [unexpected token: JOIN].
05/07/25 15:42:39 at oracle.toplink.exceptions.EJBQLException.recognitionException(EJBQLException.java:64)
05/07/25 15:42:39 at oracle.toplink.internal.parsing.ejbql.EJBQLParserBase.reportError(EJBQLParserBase.java:1088)
05/07/25 15:42:39 at oracle.toplink.internal.parsing.ejbql.antlr272.EJBQLParser.selectStatement(EJBQLParser.java:141)
05/07/25 15:42:39 at oracle.toplink.internal.parsing.ejbql.antlr272.EJBQLParser.document(EJBQLParser.java:61)
05/07/25 15:42:39 at oracle.toplink.internal.parsing.ejbql.EJBQLParserBase.parseEJBQLString(EJBQLParserBase.java:1142)
05/07/25 15:42:39 at oracle.toplink.internal.ejb.cmp3.EJBQueryImpl.buildDatabaseQuery(EJBQueryImpl.java:96)
05/07/25 15:42:39 at oracle.toplink.internal.annotations.EJBAnnotationsProcessor.addNamedQueriesToSession(EJBAnnotationsProcessor.java:107)
05/07/25 15:42:39 ... 16 more
Joins seems to be broken in Oracle's EJB 3 Preview unless I am doing something wrong