java 休眠类型的区别:boolean, yes_no, true_false

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2145027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:39:56  来源:igfitidea点击:

Differerence between hibernate types: boolean, yes_no, true_false

javadatabasehibernatetypes

提问by flybywire

When to use each? To what do they map in the database?

什么时候使用?它们在数据库中映射到什么?

采纳答案by mlathe

from Hibernate: http://docs.jboss.org/hibernate/stable/core.old/reference/en/html_single/#mapping-types-basictypes

来自休眠:http: //docs.jboss.org/hibernate/stable/core.old/reference/en/html_single/#mapping-types-basictypes

boolean, yes_noand true_falseare all alternative encodings for a Java boolean or java.lang.Boolean.

booleanyes_notrue_false都是 Java boolean 或 java.lang.Boolean 的替代编码。

回答by Adeel Ansari

Follow true_false, if you like T/Fat database level. Otherwise, use yes_no, it will give you Y/Nin the database.

按照true_false,如果您喜欢T/F在数据库级别。否则,使用yes_no,它会给你Y/N在数据库中。

By the way, got to know that there are some issues with these, which result in unexpected value. For example hereand here, Few seems fixed already in successive updates, though.

顺便说一下,了解到这些存在一些问题,导致了意想不到的价值。例如herehere,虽然在连续更新中似乎已经修复了很少。