java - Database column requires int, but doesn't throw exception when string is inputted -
i have rest service has database. when add entity database in ejb using entityfacade, 1 entity variable price requires real. if input price string in xml format client, no exception thrown , database registers 0 instead. if make variable large proper exception thrown.
any ideas of why happening? or there way if setting database table accept integer only?
@entity @table(name = "books", catalog = "", schema = "david") @xmlrootelement public class books implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) //@notnull @column(name = "bookid") private integer bookid; @basic(optional = false) @notnull @column(name = "isbn") private long isbn; @basic(optional = false) @notnull @size(min = 1, max = 40) @column(name = "publisher") private string publisher; @column(name = "quantity") private int quantity; @basic(optional = false) @notnull @column(name = "price") private float price; create table books (bookid integer default autoincrement: start 1 increment 1 not null generated identity, isbn bigint not null, title varchar(100) not null, copyright varchar(4) not null, publisher varchar(40) not null, quantity integer, price real not null, primary key (bookid));
Comments
Post a Comment