简体   繁体   中英

MongoDB Caused by: java.sql.SQLException: Data too long for column 'scenario_order' at row 1

I want to configure p:inputNumber to accept only numbers from 1 to 10 :

<p:inputNumber id="scenarioOrder" label="scenarioOrder" value="#{userScenarios.userScenarioModel.scenarioOrder}" decimalSeparator="." decimalPlaces="0" minValue="1" maxValue="10" />

Entity configuration :

@Column(name = "scenario_order")
private Integer scenarioOrder;

But when I try to insert into data base the number value I get :

Caused by: java.sql.SQLException: Data too long for column 'scenario_order' at row 1

Do you know how I can fir this?

You can use :

@Column(name = "scenario_order", columnDefinition = "TINYINT") 
@Size(min = 1, max = 10)
private Integer scenarioOrder;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM