简体   繁体   中英

Can not persist an object with Id equals new BigDecimal(0)

The problem is that the cat object is not persisted if I set the id to 0 :

cat.setId(new BigDecimal(0));
session.save(cat);

It works with all the other numbers but not 0. Why ?

Well, sorry, in fact it works when I begin my loop from i = 1.

In fact, the real problem is that the cat object is not persisted if I set the id to 0 :

cat.setId(new BigDecimal(0));
session.save(cat);

If anyone knows why ? I should ask this in a new question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM