After having changed a value in the Film Editor, if you try to save your change into the database, an error occurs:
* Caused by: java.sql.SQLException: Data truncated for column 'release_year' at row 1
\\
This error is caused by a inaccurate mapping of the special type year of the column "release_year" in the table Film of the **mysql** database.
release_year year(4)
is mapped in:
private Date releaseYear;
In order to fix the problem, you must apply these 4 changes:
== Changes on Film.java file ==
Update
private Date releaseYear;
...
@Temporal(TemporalType.DATE)
@Column(name="release_year", length=0)
public Date getReleaseYear() {
return this.releaseYear;
}
public void setReleaseYear(Date releaseYear) {
this.releaseYear = releaseYear;
}
by
private Date releaseYear;
...
@Temporal(TemporalType.DATE)
@Column(name="release_year", length=0)
public Date getReleaseYear() {
return this.releaseYear;
}
public void setReleaseYear(Date releaseYear) {
this.releaseYear = releaseYear;
}
Regenerate EJB is you use a application server.
\\
== Changes on FilmDI.axml file ==
Update
by
return #FV() < 1900 || #FV() > 2155;
\\
== Changes on FilmTI.axml file ==
Update
by
\\
== Changes on film.properties file ==
add line:
invalid.year.value = Invalid year '{0}'! Value must be between 1900 and 2155
\\
----
\\
==== Update Scenario.xml to inject changes inside automatic generation process ====
By modifying the **Scenario.xml** file as follows, you force the automatic generation process to include changes described above.
\\
Update
by
return #FV() < 1900 || #FV() > 2155;
Each time, you decide to relaunch a generation process, these modifications will be made in appropriate files.
|< 100% 10em - >|
^ Line 159:|@#eff5fb:add an item in **FilmGENERATED.properties** file.|
^ Line 161:|@#eff5fb:Type for **release_year** is **int**. Change will automatically be made in the accurate pojo (**fFilm.java**).|
^ Line 162:|@#eff5fb:The controller linked to **release_year** will be a **FormattedText** controller.|
^ Lines 164-166:|@#eff5fb:Add a validator: value of the property must be between 1900 and 2155.|
\\
\\
These intended modifications can be stored in a customized Scenario Tree which will be merged to the standard Scenario Tree as shown in this [[customize_scenario|page]].