使用空值更新DB Model列时出现问题

时间:2016-09-27 21:26:13

标签: activejdbc javalite

我最近升级到activejdbc 1.4.12,并且在更新具有空值的记录时我注意到了不同的行为。

请查看以下示例:

public void createClient()
{
    // create new client
    Client client = new Client();
    client.setName("test 1");
    client.setAddress("address 1");
    client.save();

    System.out.println("Client id: " + client.getId()); // prints Client id: 10
}

public void updateClient()
{
    // update client information
    Client client = new Client();
    client.setId(10);
    client.setName("test 2");
    client.save() ;     
}   

Then, calling System.out.println("Client address: " + client.getAddress()); I get the following results:
With activejdbc 1.4.9 -> null
With activejdbc 1.4.12 -> "address 1"

显然,从版本1.4.12开始,如果我明确地调用set(address,null),地址将仅使用null更新。还有谁有相同的问题吗?这是对的吗?

0 个答案:

没有答案
相关问题