Gonzalo García Jaubert created OPENJPA-2678:
-----------------------------------------------
Summary: MultiValuedTrasveralAttempt not evaluated when there is
another field with the same name in the path
Key: OPENJPA-2678
URL: https://issues.apache.org/jira/browse/OPENJPA-2678
Project: OpenJPA
Issue Type: Bug
Components: kernel
Affects Versions: 2.4.1
Reporter: Gonzalo García Jaubert
Priority: Minor
h2. Problem
MultiValuedTrasveralAttempt not evaluated when there is another field with the
same name in the path.
h2. Steps:
1. Create a client entity as:
{code:java}
@Entity
public class Client {
@Id
@GeneratedValue
private Integer id;
@OneToMany
private Collection<Product> products;
...
{code}
2. and a Product:
{code:java}
@Entity
public class Product {
@Id
@GeneratedValue
private Integer id;
@ManyToOne
private Client client;
private Boolean deleted = false;
...
{code}
3. Run this query:
SELECT DISTINCT c
FROM Client c JOIN FETCH c.products
WHERE c.products.deleted = false
Result is: "JPQL does not allow traversal through multi-valued relation path.
Try join instead"
4. Add a deleted field to the *client*:
{code:java}
private Boolean deleted;
{code}
5. Run the query again
No errors!
h2. Expected result:
Same exception when client have a *deleted* field
*org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.traversePath* is
finding the wrong *deleted* field in the *c.products* path (the client.delete)
and isMultiValuedTraversalAttempt is never evaluated
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)