Skip to content

Instantly share code, notes, and snippets.

View lukaseder's full-sized avatar

Lukas Eder lukaseder

View GitHub Profile
@domdorn
domdorn / DSLWrapper.java
Last active August 29, 2015 14:05
Problem with jOOQ and Scala
package helpers;
import org.jooq.DSLContext;
import java.util.Collection;
/**
*
*/
public class DSLWrapper {
@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
public class EZMap<T> {
public static void main(String[] args) {
Map<String,Object> m = hashMap(
bob -> 5,
TheGimp -> 8,
incredibleKoolAid -> "James Taylor",
heyArnold -> new Date()
);
System.out.println(m);
}
@Table(name="FOO")
public class Bar{
@Column(name="MY_CUSTOM_NAME")
private String name;
}
/*
Table structure :
--------------------
| FOO |
object vals {
val fn: Int => String = (n) => n.toString
val f = fn _ // works because fn is a method
def method = {
val fn: Int => String = (n) => n.toString
val f = fn _ // doesn't work because fn is not a method
}
}

Demonstration of using SBT to invoke jOOQ-codegen

The "jooq-codegen" task generates sources under "src/main/jooq" (which is added as a Java source directory). I put them here instead of "src/main/java" because the directory must be emptied before generation, so I don't want to chance emptying a directory that might contain other sources.

I check the jOOQ-generated code into version control. This makes it easier to work away from the office where I don't have easy access to the database. It also gives me a better picture of database changes, because they are reflected as commits.

apply from: "${rootDir}/gradle/java.gradle"
dependencies {
compile libraries.guava
compile libraries.guice
compile libraries.jooq
}
buildscript {
repositories {
@jandrewthompson
jandrewthompson / TestJooqConnection.java
Created February 26, 2013 22:29
Mocking java.sql.Connection with JOOQ file based input provider
package com.jthompson;
import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import lombok.extern.java.Log;
import org.jooq.tools.jdbc.MockConnection;
import org.jooq.tools.jdbc.MockDataProvider;