Java 使用@OrderBy注释生成的查询错误

Java 使用@OrderBy注释生成的查询错误,java,hibernate,orm,annotations,Java,Hibernate,Orm,Annotations,我正在使用Hibernate3,我有一个具有以下集合的实体: @ManyToMany @JoinTable(name = "buys_publishers", joinColumns=@JoinColumn(name="buy_id", referencedColumnName = "buy_id"), inverseJoinColumns=@JoinColumn(name = "publisher_id", referencedColumnName = "publisher_id"))

我正在使用Hibernate3,我有一个具有以下集合的实体:

@ManyToMany  
@JoinTable(name = "buys_publishers", joinColumns=@JoinColumn(name="buy_id", referencedColumnName = "buy_id"), inverseJoinColumns=@JoinColumn(name = "publisher_id", referencedColumnName = "publisher_id"))  
@OrderBy("name")  
private List<Publisher> publishers;
超级级:

@Entity
@Table(name="accounts")
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Account implements Serializable{

   /**
    * 
    */
   private static final long serialVersionUID = 1L;


   @Id
   @Column(name="id",unique=true, nullable=false )
   @GeneratedValue( strategy = IDENTITY )
   private long id;

   @Column(name = "name")
   private String name;

   @Column(name = "account_type")
   @Enumerated(EnumType.ORDINAL)
   private AccountType accountType;

   public long getId() {
      return id;
   }

   public void setId(long id) {
      this.id = id;
   }

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public AccountType getAccountType() {
      return accountType;
   }

   public void setAccountType(AccountType accountType) {
      this.accountType = accountType;
   }

}
Hibernate生成的查询是:

select publishers0_.buy_id as buy1_1_, publishers0_.publisher_id as publisher2_1_, publisher1_.account_id as id6_0_, publisher1_1_.account_type as account2_6_0_, publisher1_1_.name as name6_0_, publisher1_.publisher_id as publisher1_18_0_ from buys_publishers publishers0_ left outer join publishers publisher1_ on publishers0_.publisher_id=publisher1_.publisher_id left outer join accounts publisher1_1_ on publisher1_.account_id=publisher1_1_.id where publishers0_.buy_id=? order by accounts.name asc
从查询中可以清楚地看出,order by应该在publisher1上,我是做错了什么还是这是一个bug

谢谢。

这看起来像是(我不希望有短期的解决方案)

select publishers0_.buy_id as buy1_1_, publishers0_.publisher_id as publisher2_1_, publisher1_.account_id as id6_0_, publisher1_1_.account_type as account2_6_0_, publisher1_1_.name as name6_0_, publisher1_.publisher_id as publisher1_18_0_ from buys_publishers publishers0_ left outer join publishers publisher1_ on publishers0_.publisher_id=publisher1_.publisher_id left outer join accounts publisher1_1_ on publisher1_.account_id=publisher1_1_.id where publishers0_.buy_id=? order by accounts.name asc