coba panggil method getBooks()
trus liat sql yg digenerate seperti apa...
sepertinya defaultnya dia lazy, sehingga
kalo yg diambil data Author saja,
isinya getBooks() gak langsung diambil

On Mon, Feb 9, 2009 at 7:52 PM, Agustino <siau_...@yahoo.com> wrote:
> Hi All,
>
> g mo test subselect pada one-to-many, tapi koq munculnya malah query
> biasa ya?
>
> public class Author implements Serializable {
> private List<Book> books;
> @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "author")
>
> @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
> public List<Book> getBooks() {
> return books;
> }
>
> public void setBooks(List<Book> books) {
> this.books = books;
> }
> }
>
> public class Book implements Serializable {
> private Author author;
> @ManyToOne
> @JoinColumn(name = "authorID", nullable = false)
> @ForeignKey(name = "FK_AUTHOR")
> public Author getAuthor() {
> return author;
> }
>
> public void setAuthor(Author author) {
> this.author = author;
> }
> }
>
> sql yg diexecute:
> select
> books0_.authorID as authorID1_,
> books0_.id as id1_,
> books0_.id as id1_0_,
> books0_.authorID as authorID1_0_,
> books0_.delFlag as delFlag1_0_,
> books0_.isbn as isbn1_0_,
> books0_.title as title1_0_
> from
> book books0_
> where
> books0_.authorID=?
>
> 



-- 
syaiful.mukhlis
gtalk:syaiful.mukh...@gmail.com

Kirim email ke