Java querydsl,将空值设置为column causes NullPointerException
我第一次在stackoverflow上发帖,但我真的需要一些帮助 我不使用类生成来映射实体。我正在使用queryDSL版本4.0.5 这是我的密码:Java querydsl,将空值设置为column causes NullPointerException,java,exception,null,querydsl,Java,Exception,Null,Querydsl,我第一次在stackoverflow上发帖,但我真的需要一些帮助 我不使用类生成来映射实体。我正在使用queryDSL版本4.0.5 这是我的密码: SQLTemplates templates = MySQLTemplates.builder().printSchema().build(); Configuration configuration = new Configuration( templates ); try { Class.for
SQLTemplates templates = MySQLTemplates.builder().printSchema().build();
Configuration configuration = new Configuration( templates );
try
{
Class.forName( "com.mysql.jdbc.Driver" );
final Connection connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root", "" );
SQLQuery sqlQuery = new SQLQuery( connection, configuration );
// querying
NumberPath< Long > volume = Expressions.numberPath( Long.class, "volume" );
RelationalPathBase< Object > r = new RelationalPathBase< Object >( Object.class, "", "test", "mstf" );
Provider< java.sql.Connection > provinv = new Provider< Connection >()
{
@Override
public Connection get()
{
return connection;
}
};
SQLQueryFactory queryFactory = new SQLQueryFactory( configuration, provinv );
queryFactory.update( r ).setNull( volume ).execute();
}
catch( Exception e )
{
e.printStackTrace();
}
当然,我们有一个整数类型的jdbcType,它是null,我们必须返回一个int
知道如何在我的列中输入空数据吗?
非常感谢
public int getJdbcType() {
return jdbcType;
}