Skip to content

Instantly share code, notes, and snippets.

@masanobuimai
Created February 27, 2009 07:52
Show Gist options
  • Save masanobuimai/71339 to your computer and use it in GitHub Desktop.
Save masanobuimai/71339 to your computer and use it in GitHub Desktop.
Grails1.1でjoin fetch
class Blog {
String title
String body
FileInfo uploadedFile
static constraints = {
title()
body maxSize: 4000
uploadedFile nullable: true
}
static mapping = {
uploadedFile fetch:'join'
}
}
Hibernate:
select
top ? this_.id as id0_1_,
this_.version as version0_1_,
this_.body as body0_1_,
this_.title as title0_1_,
this_.uploaded_file_id as uploaded5_0_1_,
fileinfo2_.id as id1_0_,
fileinfo2_.version as version1_0_,
fileinfo2_.content_type as content3_1_0_,
fileinfo2_.file_content_id as file4_1_0_,
fileinfo2_.filename as filename1_0_
from
blog this_
left outer join
file_info fileinfo2_
on this_.uploaded_file_id=fileinfo2_.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment