What is meant by "1 comment awaiting moderation" near my entry?
[EJB 3.0] - A classic EJB Left Join and Order By
	clause problem
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > Java Programming > [EJB 3.0] - A classic EJB Left Join and Order By clause problem 16 September 2006 22:10:52

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

[EJB 3.0] - A classic EJB Left Join and Order By clause problem

App4you@Yahoo.Com 16 September 2006 22:10:52
 Good day,

I am using Oracle 9i and I would like to apply the ORDER BY on the Customer.state when querying the Order class.

1. Here are the entities:

@Entity
@Table(name="ORDERS­")
public class Order implements Serializable{
...

@ManyToOne
@JoinColumn(name="U­SERID")
public Customer getCustomer() {
return customer;
}
public void setCustomer(Custome­r customer) {
this.customer = customer;
}

@ManyToOne
@JoinColumn(name="P­RODUCTID")
public Customer getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}

...
}


@Entity
public class Customer implements Serializable{
String address1;
String address2;
String city;
String state;
String zip;
...
}

@Entity
public class Product implements Serializable{
int productid;
String productName;
...
}


2. Here is the query that I would like to get it working so that the result will be a list of the Order entity bean where I can get all the
products and the customers for a report listing. Please notice the DISTINCT and the ORDER BY clause on the Order's customer state property.

.createQuery("selec­t distinct order
from Order order
left join order.customer customer
order by customer.state");

3. All worked fine on the MySQL DB server, but Oracle threw an error saying something like " not SELECTed statement " which
means that the order by column must be a part of the select statement.

4. Question: how can we go about to make the above statement work so that I can get all the results?

Your help is greatly appreciated.

Thank you,
John

View the original post : http://www.jboss.co­m/index.html?module=­bb&op=viewtopic&p=39­72116#3972116

Reply to the post : http://www.jboss.co­m/index.html?module=­bb&op=posting&mode=r­eply&p=3972116
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > Java Programming > [EJB 3.0] - A classic EJB Left Join and Order By clause problem 16 September 2006 22:10:52

see also:
getting the IP address of a visitor to…
Problems with opening a word doc on…
RE: :Mechanize ->links() problem
pass tests:
†...Avatars from Moka...†
see also:
Hello everyone! I'm Russian and I s...
Share the way to rip DVD and convert…

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .