No validator could be found for type: java.lang.Long :No validator could be found for type: java.lang.Long -


i have object class has no required field except id. here code:

entity @xmlrootelement @table(name = "t_host_spec") @cacheable(false) @namedqueries({     @namedquery(name = hostspec.find_all, query = "select m hostspec m")     ,@namedquery(name = hostspec.find_by_ip_context_path_port, query = "select m hostspec m m.ip = :ip , m.contextpath =:contextpath , m.port =:port ")}) public class hostspec extends abstractentity {        @id     @sequencegenerator(name = "host_spec_sequence_generator", sequencename = "host_spec_seq", initialvalue = 1, allocationsize = 1)     @generatedvalue(strategy = generationtype.sequence, generator = "host_spec_sequence_generator")     @xmlelement(name = "id")     @notnull     @column(name = "id", nullable = false)     private long id;      @size(max =200 )     @column(name = "app_name",length = 25)     @xmlelement(name = "app_name")     private string appname;      @size(max =1000 )     @column(name = "app_server_info",length = 25)     @xmlelement(name = "app_server_info")     private string serverinfo;      @size(max =100 )     @column(name = "context_path",length = 25)     @xmlelement(name = "context_path")     private string contextpath;      @size(max =255 )     @column(name = "build_date",length = 25)     @xmlelement(name = "build_date")     private string builddate;      @size(max =4000 )     @column(name = "description",length = 25)     @xmlelement(name = "description")     private string description;       @size(max =50 )     @column(name = "ip",length = 25)     @xmlelement(name = "ip")     private string ip;      @size(max =200 )     @column(name = "module_name",length = 25)     @xmlelement(name = "module_name")     private string modulename;      @size(max =100 )     @column(name = "name",length = 25)     @xmlelement(name = "name")     private string name;      @size(max = 10)     @xmlelement(name = "port")     @column(name = "port")     private long port;      @size(max =20 )     @column(name = "protocol",length = 25)     @xmlelement(name = "protocol")     private string protocol;       @size(max = 10)     @xmlelement(name = "version_code")     @column(name = "version_code")     private long versioncode;      @size(max =100 )     @column(name = "version_name",length = 25)     @xmlelement(name = "version_name")     private string versionname;      @size(max =100 )     @column(name = "virtual_server_name",length = 25)     @xmlelement(name = "virtual_server_name")     private string servername;  //getters & setters 

when try run it, exception throws: javax.validation.unexpectedtypeexception: hv000030: no validator found type: java.lang.long please help

@size not intended used on type long (you shall use @max in case).

hence, should replace @size(max = 10) corresponding @max annotation on fields port , versioncode

according javadoc, @size can used on following types :

  • string (string length evaludated)
  • collection (collection size evaluated)
  • map (map size evaluated)
  • array (array length evaluated)
  • null elements considered valid.

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -