This commit is contained in:
sxyx2008
2014-07-15 14:56:21 +08:00
parent e18267c012
commit 90c8de251a
23 changed files with 261 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
spring-jdbc-tutorials
===============
spring jdbc 教程 覆盖以下内容:
* 使用QueryDsl查询记录
* 使用JdbcTemplate查询记录
* 使用NamedParameterJdbcTemplate查询记录
* 使用SimpleJdbcInsert新增
* 使用SimpleJdbcCall调用存储过程和函数
* 使用MappingSqlQuery查询记录
* 使用SqlUpdate新增记录
* 使用OneToManyResultSetExtractor spring jdbc 一对多查询
* 使用ParameterizedBeanPropertyRowMapper查询记录
* 使用BeanPropertySqlParameterSource查询记录
* 使用MapSqlParameterSource查询记录
* 使用KeyHolder获取新增数据库自动生成的主键
* 使用BatchPreparedStatementSetter查询记录
* 使用SqlParameterSourceUtils查询记录
* 使用BeanPropertyRowMapper查询记录
* 使用用户自定义的RowMapper查询记录
使用querydsl-maven-plugin生成querydsl
querydsl-maven-plugin usage
```
mvn com.mysema.querydsl:querydsl-maven-plugin:export
```
@@ -0,0 +1,48 @@
package org.spring.jdbc.tutorials.model;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.path.*;
import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
/**
* QAddress is a Querydsl query type for QAddress
*/
@Generated("com.mysema.query.sql.codegen.MetaDataSerializer")
public class QAddress extends com.mysema.query.sql.RelationalPathBase<QAddress> {
private static final long serialVersionUID = -1326889475;
public static final QAddress address = new QAddress("address");
public final StringPath city = createString("city");
public final NumberPath<Integer> custId = createNumber("cust_id", Integer.class);
public final NumberPath<Integer> id = createNumber("id", Integer.class);
public final StringPath street = createString("street");
public final com.mysema.query.sql.PrimaryKey<QAddress> primary = createPrimaryKey(id);
public final com.mysema.query.sql.ForeignKey<QCustomer> addressCustomerRef = createForeignKey(custId, "CUST_ID");
public QAddress(String variable) {
super(QAddress.class, forVariable(variable), "null", "address");
}
@SuppressWarnings("all")
public QAddress(Path<? extends QAddress> path) {
super((Class)path.getType(), path.getMetadata(), "null", "address");
}
public QAddress(PathMetadata<?> metadata) {
super(QAddress.class, metadata, "null", "address");
}
}
@@ -0,0 +1,48 @@
package org.spring.jdbc.tutorials.model;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.path.*;
import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
/**
* QContact is a Querydsl query type for QContact
*/
@Generated("com.mysema.query.sql.codegen.MetaDataSerializer")
public class QContact extends com.mysema.query.sql.RelationalPathBase<QContact> {
private static final long serialVersionUID = 772329001;
public static final QContact contact = new QContact("contact");
public final StringPath address = createString("address");
public final NumberPath<Integer> contactId = createNumber("contact_id", Integer.class);
public final StringPath email = createString("email");
public final StringPath name = createString("name");
public final StringPath telephone = createString("telephone");
public final com.mysema.query.sql.PrimaryKey<QContact> primary = createPrimaryKey(contactId);
public QContact(String variable) {
super(QContact.class, forVariable(variable), "null", "contact");
}
@SuppressWarnings("all")
public QContact(Path<? extends QContact> path) {
super((Class)path.getType(), path.getMetadata(), "null", "contact");
}
public QContact(PathMetadata<?> metadata) {
super(QContact.class, metadata, "null", "contact");
}
}
@@ -0,0 +1,46 @@
package org.spring.jdbc.tutorials.model;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.path.*;
import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
/**
* QCustomer is a Querydsl query type for QCustomer
*/
@Generated("com.mysema.query.sql.codegen.MetaDataSerializer")
public class QCustomer extends com.mysema.query.sql.RelationalPathBase<QCustomer> {
private static final long serialVersionUID = -653977867;
public static final QCustomer customer = new QCustomer("customer");
public final NumberPath<Integer> age = createNumber("AGE", Integer.class);
public final NumberPath<Integer> custId = createNumber("CUST_ID", Integer.class);
public final StringPath name = createString("NAME");
public final com.mysema.query.sql.PrimaryKey<QCustomer> primary = createPrimaryKey(custId);
public final com.mysema.query.sql.ForeignKey<QAddress> _addressCustomerRef = createInvForeignKey(custId, "cust_id");
public QCustomer(String variable) {
super(QCustomer.class, forVariable(variable), "null", "customer");
}
@SuppressWarnings("all")
public QCustomer(Path<? extends QCustomer> path) {
super((Class)path.getType(), path.getMetadata(), "null", "customer");
}
public QCustomer(PathMetadata<?> metadata) {
super(QCustomer.class, metadata, "null", "customer");
}
}
@@ -0,0 +1,44 @@
package org.spring.jdbc.tutorials.model;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.path.*;
import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
/**
* QEmployee is a Querydsl query type for QEmployee
*/
@Generated("com.mysema.query.sql.codegen.MetaDataSerializer")
public class QEmployee extends com.mysema.query.sql.RelationalPathBase<QEmployee> {
private static final long serialVersionUID = -66683451;
public static final QEmployee employee = new QEmployee("employee");
public final NumberPath<Integer> age = createNumber("AGE", Integer.class);
public final NumberPath<Integer> id = createNumber("ID", Integer.class);
public final StringPath name = createString("NAME");
public final com.mysema.query.sql.PrimaryKey<QEmployee> primary = createPrimaryKey(id);
public QEmployee(String variable) {
super(QEmployee.class, forVariable(variable), "null", "employee");
}
@SuppressWarnings("all")
public QEmployee(Path<? extends QEmployee> path) {
super((Class)path.getType(), path.getMetadata(), "null", "employee");
}
public QEmployee(PathMetadata<?> metadata) {
super(QEmployee.class, metadata, "null", "employee");
}
}
@@ -0,0 +1,28 @@
package org.spring.jdbc.tutorials.model;
public class Address {
private Integer id;
private String street;
private String city;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}