我最近升级到了 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。还有谁有相同的问题吗?这个对吗?