java - Spring error converting nvarchar to bigint -
i'm getting error whenever try save object.
the field causing error string
mapped varchar(200)
in database.
name of field localcontact
.
here's code:
site.java:
@entity @table(name = "site", uniqueconstraints = { @uniqueconstraint(columnnames = { "site_country_id", "site_name" }) }) @audited(targetauditmode = relationtargetauditmode.not_audited, withmodifiedflag = true) public class site implements isite { /** constant serialversionuid. */ private static final long serialversionuid = -390717603276436784l; /** id. */ @id @generatedvalue(strategy = generationtype.auto) @column(name = "site_id", unique = true, nullable = false) private long id; /** site address. */ @column(name = "site_address", length = businessconstants.site_address) private string address; /** site analog phone number. */ @column(name = "site_analog_phone_number", length = businessconstants.site_analog_phone_number) private string analogphonenumber; /** site comment. */ @column(name = "site_comment", length = businessconstants.site_comment) private string comment; /** site entity code. */ @digits(integer = 3, fraction = 0, message = "please enter max 3 digits") @column(name = "site_entity_code", nullable = false) private long entitycode; /** site invoice code. */ @digits(integer = 10, fraction = 0, message = "please enter max 10 digits") @column(name = "site_invoice_code", nullable = false) private long invoicecode; /** site local phone. */ @column(name = "site_local_it_phone", length = businessconstants.site_local_it_phone) private string localitphone; /** site name. */ @notblank @column(name = "site_name", nullable = false, length = businessconstants.site_name) private string sitename; /** site subnet. */ @notblank @column(name = "site_subnet", nullable = false, length = businessconstants.site_subnet) private string subnet; /** site user number. */ @digits(integer = 4, fraction = 0, message = "please enter max 4 digits") @column(name = "site_user_number") private long usernumber; /** business. */ @valid @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "site_business_id", nullable = false) private business business; /** country. */ @valid @manytoone(fetch = fetchtype.eager) @joincolumn(name = "site_country_id") private country country; /** local contact. */ @column(name = "site_local_contact", nullable = true, length = businessconstants.local_contact) private string localcontact; //the field cause error /** local it. */ @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "site_local_it", nullable = true) private user localit; /** rif. */ @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "site_rif", nullable = true) private user rif; /** status. */ @valid @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "site_status_id", nullable = false) private status status; /** end date. */ @column(name = "site_end_date") @temporal(temporaltype.timestamp) @datetimeformat(iso = iso.date_time) private date enddate = null; @manytomany(targetentity = user.class, mappedby = "usersites", fetch = fetchtype.lazy) @notaudited private set<iuser> siteusers; /** * gets local contact. * * @return local contact */ public string getlocalcontact() { return this.localcontact; } /** * sets local contact. * * @param localit new local contact */ public void setlocalcontact(string localcontact) { this.localcontact = localcontact; }
my jsp :
<td class="label"><spring:message code="site.localcontact" /></td> <td class="value"> <form:input path="site.localcontact"></form:input> </td>
my dao:
public void savesite(isite siteobj){ assert.notnull(siteobj); merge((site) siteobj); }
edit
the error being thrown is:
caused by: com.microsoft.sqlserver.jdbc.sqlserverexception: error converting data type nvarchar bigint
i found error,
i have table making historic of site named site_aud , field site_local_contact in bigint.
Comments
Post a Comment