My User
entity class contains password hash field, which is a byte array with a fixed length (32 since it's an SHA-256 hash).
@Entity
public class User {
@Column(nullable=false)
private byte[] passwordHash;
...
}
As you can see, I haven't annotated it with anything special, just a NOT NULL.
This works, but will it perform? My schema is generated by Hibernate, but I don't know exactly what it generates (I'm currently using an in-memory HSQL database).
I'm concerned that, since it doesn't know that it's a fixed length array (the length
field of the Column
annotation applies to strings only), it will store this hash in a BLOB field which is added in the record as a pointer (if I understand correctly how databases work).
Is this true, and how can I change this? Should I just encode the hash as a string, with base64 or hex, accepting the small performance/correctness impact of that?