This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RepositoryInstance repositoryInstance; //some Repository which has findById. | |
List<T> lazyList = LazyListUtil.idListToLazyList(jdbcTemplate.queryForList("select foreign_key from join_table where primary_key = ?",new Object[]{id},String.class),repositoryInstance)); | |
// The only query run so far "select foreign key from join_table where primary_key = ?" . the others aren't run until we use lazyList, which would be inside RepositoryInstance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import java.util.List; | |
import org.junit.Test; | |
import com.google.common.base.Function; | |
import com.google.common.base.Supplier; | |
import com.google.common.base.Suppliers; | |
import com.google.common.collect.ImmutableList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collection; | |
import java.util.List; | |
import java.util.ListIterator; | |
import org.springframework.data.domain.PageImpl; | |
import org.springframework.data.domain.Pageable; | |
/** | |
* Extension class between spring data commons and java.util.List that is | |
* required to get MyBatis to use it as a return value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accounts = table("accounts") | |
migration("add_ssl") { | |
up { | |
add_column accounts "ssl_enabled" Fields.boolean { | |
defaults 1 | |
} | |
} | |
down { | |
remove_column accounts "ssl_enabled" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/time.json") | |
public class GetTimeResource | |
{ | |
@GET | |
@Produces("application/json") | |
public String currentTimeAsJson() { | |
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); | |
//get current date time with Date() | |
Date date = new Date(); | |
return String.format("{\"timeKey\":\"%s\"}",dateFormat.format(date)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Resource which shows the hello world message. | |
* | |
* @author sheenobu | |
* | |
*/ | |
@Path("/") | |
public class HelloWorldResource { | |
// we don't need to load this from a singleton context (yet) because |
OlderNewer