Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA Character mappings

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

I understand that table attributes are mapped 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.

like image 582
Radion Avatar asked Jan 19 '23 21:01

Radion


1 Answers

String is the correct type:

@Column(length=2)
private String code;
like image 122
Bozho Avatar answered Jan 30 '23 13:01

Bozho