Which is best data type for phone number in MySQL and what should Java type mapping for it be?

后端 未结 10 1592
有刺的猬
有刺的猬 2020-12-04 11:09

I am using MySQL with Spring JDBC template for my web application. I need to store phone number with only digits (10). I am little bit confused about data type using data ty

10条回答
  •  时光取名叫无心
    2020-12-04 11:31

    My requirement is to display 10 digit phone number in the jsp. So here's the setup for me.
    MySQL: numeric(10)

    Java Side:

    @NumberFormat(pattern = "#")  
    private long mobileNumber;
    

    and it worked!

提交回复
热议问题