Fixed tutorial bug
This commit is contained in:
parent
300c4b8693
commit
411a66eac1
@ -83,7 +83,7 @@ that looks like this:
|
||||
</p>
|
||||
<pre class="prettyprint lang-xml">
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd">
|
||||
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.0.0.xsd">
|
||||
<!-- Configure the database connection here -->
|
||||
<jdbc>
|
||||
<driver>com.mysql.jdbc.Driver</driver>
|
||||
@ -115,13 +115,6 @@ that looks like this:
|
||||
<excludes></excludes>
|
||||
</database>
|
||||
|
||||
<generate>
|
||||
<!-- Primary key / foreign key relations should be generated and used.
|
||||
This will be a prerequisite for various advanced features
|
||||
Defaults to false -->
|
||||
<relations>true</relations>
|
||||
</generate>
|
||||
|
||||
<target>
|
||||
<!-- The destination package of your generated classes (within the destination directory) -->
|
||||
<packageName>test.generated</packageName>
|
||||
@ -269,8 +262,8 @@ This is pretty standard code for establishing a MySQL connection.
|
||||
Let's add a simple query:
|
||||
</p>
|
||||
<pre class="prettyprint lang-java">
|
||||
Factory create = new Factory(conn, SQLDialect.MYSQL);
|
||||
Result<Record> result = create.select().from(POSTS).fetch();
|
||||
Executor create = new Executor(conn, SQLDialect.MYSQL);
|
||||
Result<Record> result = Executor.select().from(POSTS).fetch();
|
||||
</pre>
|
||||
<p>
|
||||
First get an instance of <code>Factory</code> so we can write a simple
|
||||
@ -309,16 +302,10 @@ package test;
|
||||
import static test.generated.Tables.*;
|
||||
import static org.jooq.impl.Factory.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.impl.Factory;
|
||||
|
||||
import test.generated.tables.Posts;
|
||||
import org.jooq.*;
|
||||
import org.jooq.impl.*;
|
||||
|
||||
public class Main {
|
||||
|
||||
@ -336,8 +323,8 @@ public class Main {
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
conn = DriverManager.getConnection(url, userName, password);
|
||||
|
||||
Factory create = new Factory(conn, SQLDialect.MYSQL);
|
||||
Result<Record> result = create.select().from(POSTS).fetch();
|
||||
Executor create = new Executor(conn, SQLDialect.MYSQL);
|
||||
Result<Record> result = create.select().from(POSTS).fetch();
|
||||
|
||||
for (Record r : result) {
|
||||
Long id = r.getValue(POSTS.ID);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user