我们可以将char[]Map到hibernate实体中的varchar吗?

e1xvtsh3  于 2021-06-29  发布在  Java
关注(0)|答案(1)|浏览(391)

我们不希望将密码存储在hibernate实体类的字符串变量中,而是希望将其存储在char[]数组中,以便在使用它之后清空数组。因此,我们正在减少堆检查的机会。
我需要你的建议。
db列中的密码字段- VARCHAR java hibernate实体中的密码字段- String (当前s/m)
我们能用吗 Char[] 在java Hibernate实体中,而不是 String ?

bpsygsoo

bpsygsoo1#

休眠Map Stringchar[]VARCHAR 因为它们是基本的数据类型。有关更多详细信息,请参阅文档hibernate提供的基本类型
表3.1。标准基本类型

Hibernate type (org.hibernate.type package) JDBC type   Java type   BasicTypeRegistry key(s)
StringType  VARCHAR java.lang.String    string, java.lang.String
MaterializedClob    CLOB    java.lang.String    materialized_clob
TextType    LONGVARCHAR java.lang.String    text
CharacterType   CHAR    char, java.lang.Character   char, java.lang.Character
BooleanType BIT boolean, java.lang.Boolean  boolean, java.lang.Boolean
NumericBooleanType  INTEGER, 0 is false, 1 is true  boolean, java.lang.Boolean  numeric_boolean
YesNoType   CHAR, 'N'/'n' is false, 'Y'/'y' is true. The uppercase value is written to the database.    boolean, java.lang.Boolean  yes_no
TrueFalseType   CHAR, 'F'/'f' is false, 'T'/'t' is true. The uppercase value is written to the database.    boolean, java.lang.Boolean  true_false
ByteType    TINYINT byte, java.lang.Byte    byte, java.lang.Byte
ShortType   SMALLINT    short, java.lang.Short  short, java.lang.Short
IntegerTypes    INTEGER int, java.lang.Integer  int, java.lang.Integer
LongType    BIGINT  long, java.lang.Long    long, java.lang.Long
FloatType   FLOAT   float, java.lang.Float  float, java.lang.Float
DoubleType  DOUBLE  double, java.lang.Double    double, java.lang.Double
BigIntegerType  NUMERIC java.math.BigInteger    big_integer, java.math.BigInteger
BigDecimalType  NUMERIC java.math.BigDecimal    big_decimal, java.math.bigDecimal
TimestampType   TIMESTAMP   java.sql.Timestamp  timestamp, java.sql.Timestamp
TimeType    TIME    java.sql.Time   time, java.sql.Time
DateType    DATE    java.sql.Date   date, java.sql.Date
CalendarType    TIMESTAMP   java.util.Calendar  calendar, java.util.Calendar
CalendarDateType    DATE    java.util.Calendar  calendar_date
CurrencyType    java.util.Currency  VARCHAR currency, java.util.Currency
LocaleType  VARCHAR java.util.Locale    locale, java.utility.locale
TimeZoneType    VARCHAR, using the TimeZone ID  java.util.TimeZone  timezone, java.util.TimeZone
UrlType VARCHAR java.net.URL    url, java.net.URL
ClassType   VARCHAR (class FQN) java.lang.Class class, java.lang.Class
BlobType    BLOB    java.sql.Blob   blog, java.sql.Blob
ClobType    CLOB    java.sql.Clob   clob, java.sql.Clob
BinaryType  VARBINARY   byte[]  binary, byte[]
MaterializedBlobType    BLOB    byte[]  materized_blob
ImageType   LONGVARBINARY   byte[]  image
WrapperBinaryType   VARBINARY   java.lang.Byte[]    wrapper-binary, Byte[], java.lang.Byte[]
CharArrayType   VARCHAR char[]  characters, char[]
CharacterArrayType  VARCHAR java.lang.Character[]   wrapper-characters, Character[], java.lang.Character[]
UUIDBinaryType  BINARY  java.util.UUID  uuid-binary, java.util.UUID
UUIDCharType    CHAR, can also read VARCHAR java.util.UUID  uuid-char
PostgresUUIDType    PostgreSQL UUID, through Types#OTHER, which complies to the PostgreSQL JDBC driver definition   java.util.UUID  pg-uuid
SerializableType    VARBINARY   implementors of java.lang.Serializable  Unlike the other value types, multiple instances of this type are registered. It is registered once under java.io.Serializable, and registered under the specific java.io.Serializable implementation class names.
StringNVarcharType  NVARCHAR    java.lang.String    nstring
NTextType   LONGNVARCHAR    java.lang.String    ntext
NClobType   NCLOB   java.sql.NClob  nclob, java.sql.NClob
MaterializedNClobType   NCLOB   java.lang.String    materialized_nclob
PrimitiveCharacterArrayNClobType    NCHAR   char[]  N/A
CharacterNCharType  NCHAR   java.lang.Character ncharacter
CharacterArrayNClobType NCLOB   java.lang.Character[]   N/A

相关问题