开发者

JPA Character mappings

开发者 https://www.devze.com 2023-03-01 06:48 出处:网络
I am fairly new to JPA and trying to get a basic entity setup. I understand that table attributes are m开发者_StackOverflow社区apped to java types, such as varchar being mapped to a String.

I am fairly new to JPA and trying to get a basic entity setup.

I understand that table attributes are m开发者_StackOverflow社区apped to java types, such as varchar being mapped to a String.

In my table I have a column code which is a char(2), and stores a two letter code.

How would I use this within the entity? I tried using a String, but it seems that this isn't the correct mapping to use.


String is the correct type:

@Column(length=2)
private String code;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号