0

I want to write a JDOQL query(JDOQL Delarative or JDOQL Single String ). Here are my classes

public class Customer
{
String Cid;
String Name;
String Email;
String City;
Set<Address> addresses=new HashSet<Address>();
}
public class Address 
{

String Aid;
String City; 
String Location;
}

1-N RelaitonShip between Customer and Address objects.

here's my database query

select c.Name,c.Email,a.City,a.Location from user.MASCUSTOMER c inner join user.MASADDRESS a on c.Cid= a.Cid;

How can i represent above query in the form of JDOQL (Delcarative or Single String)?

Nadendla
  • 712
  • 2
  • 7
  • 17
  • and what have you tried? – Neil Stockton Apr 26 '14 at 09:01
  • select this.Name,this.Email,this.addresses from com.domain.Customer – Nadendla Apr 28 '14 at 06:17
  • and how do you expect that to look ? addresses is a multi valued field so cannot be selected. You can refer to the address easily enough using addresses.contains(address) and then select address.blah – Neil Stockton Apr 28 '14 at 06:34
  • Thanks for your reply. I tried like this and i got the data . SELECT this.Email,this.Name,b1.Location,b1.City,b1.Aid FROM com.join.onetoMany.Customer ; query.declareVariables("com.join.onetoMany.Address b1"); – Nadendla Apr 28 '14 at 06:54
  • which is obviously not an INNER JOIN ... – Neil Stockton Apr 28 '14 at 10:01
  • yes you are absoultely correct. it's cross join.If we set filter as addresses.contains(addObj) then it will become Inner Join. – Nadendla Apr 28 '14 at 10:07

0 Answers0