New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GroypBy.list() returns only first expression of ContructorExpressions #117
Comments
Test sources: @Entity
public class Author implements Serializable {
@Id
@GeneratedValue
private Long id;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
@OneToMany(mappedBy="author")
@OrderBy("title")
private Set<Book> books;
public Set<Book> getBooks() { return books; }
public void setBooks(Set<Book> books) { this.books = books; }
}
@Entity
public class Book implements Serializable {
@Id @GeneratedValue
private Long id;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
private String title;
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
@ManyToOne
@JoinColumn(name="AUTHOR_ID")
private Author author;
public Author getAuthor() { return author; }
public void setAuthor(Author author) { this.author = author; }
}
@Test
@Transactional(readOnly=true)
public void testSomeMethod0() {
Session session = sessionFactory.getCurrentSession();
QAuthor author = QAuthor.author;
QBook book = QBook.book;
Map<Long, List<Pair<Long, String>>> map = new HibernateQuery(session)
.from(author)
.join(author.books, book)
.transform(GroupBy
.groupBy(author.id)
.as(GroupBy.list(QPair.create(book.id, book.title))));
for (Entry<Long, List<Pair<Long, String>>> entry : map.entrySet()) {
System.out.println("author = " + entry.getKey());
for (Object pair : entry.getValue()) {
System.out.println(" book = " + pair);
}
}
} |
timowest
added a commit
that referenced
this issue
Mar 23, 2012
timowest
added a commit
that referenced
this issue
Mar 23, 2012
Released in 2.5.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this query:
returns a Map that contains
List<Long>
(with book.id as elements) instead ofList<Pair<Long, String>>
Tested with querydsl 2.3.2 and hibernate 3.6.9
The text was updated successfully, but these errors were encountered: