I tried to drill down the problem to following simple example:

Address has a simple relation to Person which is derived from Employee ...

  | @javax.persistence.Entity
  | public class Address {
  |     String street;
  |     Long id;
  |     Person person;
  |     public String getStreet() {
  |         return street;
  |     }
  |     public void setStreet(String value) {
  |         street = value;
  |     }
  |     @javax.persistence.Id
  |     public Long getId() {
  |         return id;
  |     }
  |     @javax.persistence.ManyToOne
  |     public Person getPerson() {
  |         return this.person;
  |     }
  |     public void setPerson(Person person) {
  |             this.person = person;
  |     }
  | }
  | 


  | @javax.persistence.Entity
  | @javax.persistence.Inheritance(strategy = 
javax.persistence.InheritanceType.JOINED) 
  | public class Person {
  |     String name;
  |     Long id;
  |     private java.util.Set<Address> address; 
  |     public String getName() {
  |         return name;
  |     }
  |     public void setName(String value) {
  |         name = value;
  |     }
  |     @javax.persistence.Id
  |     public Long getId() {
  |         return id;
  |     }
  |     public void setId(Long value) {
  |         id = value;
  |     }
  |     @javax.persistence.OneToMany(mappedBy = "person")
  |     public java.util.Set<Address> getAddress() {
  |         return this.address;
  |     }
  |     public void setAddress(java.util.Set<Address> address) {
  |         this.address = address;
  |     }
  | }
  | 


  | @javax.persistence.Entity
  | public class Employee extends Person {      
  |     Double salary;
  |     public Double getSalary() {
  |         return salary;
  |     }
  |     public void setSalary(java.lang.Double value) {
  |         salary = value;
  |     }
  | }
  | 

Now I would like to write a simple EJBQL to query for addresses named 
"streetName" and  employees that earn more then "2000" ...


  | SELECT A FROM Address A WHERE (A.street=streetName) AND 
(A.employee.salary>2000)
  | 


==> now to my question:

As we can see, the bean path A.employee.salary is wrong and i will get a 
anonymous wrote : could not resolve property: employee

but writing 


  | SELECT A FROM Address A WHERE (A.street=streetName) AND 
(A.person.salary>2000)
  | 

is also wrong, because there is no salary attribute in the person entity ...

So how can I select in EJBQL using the path notation ?

Thx for any help



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024513#4024513

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024513
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to