diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index 94b38297..6d8cabd3 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -34,7 +34,7 @@ import java.util.Map; public class Constants { - public final static long DB_VERSION = 4; + public final static long DB_VERSION = 5; public final static String DEF_ADMIN = "admin"; public final static String DEF_ADMIN_PASSWD = "admin"; @@ -163,4 +163,5 @@ public class Constants { public final static int LEN_TEXT = 255; public final static int LEN_DESCRIPTION = 8192; + public final static int LEN_RESULT_MESSAGE = 8192; } diff --git a/src/main/java/info/bukova/isspst/data/TripBill.java b/src/main/java/info/bukova/isspst/data/TripBill.java index ca8d698f..b44ded85 100644 --- a/src/main/java/info/bukova/isspst/data/TripBill.java +++ b/src/main/java/info/bukova/isspst/data/TripBill.java @@ -1,13 +1,12 @@ package info.bukova.isspst.data; +import info.bukova.isspst.Constants; import info.bukova.isspst.storage.EntityWithAttachment; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; -import org.hibernate.search.annotations.Analyze; -import org.hibernate.search.annotations.Field; -import org.hibernate.search.annotations.Index; -import org.hibernate.search.annotations.Indexed; -import org.hibernate.search.annotations.IndexedEmbedded; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -17,10 +16,14 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.search.annotations.Analyze; +import org.hibernate.search.annotations.Field; +import org.hibernate.search.annotations.Index; +import org.hibernate.search.annotations.Indexed; +import org.hibernate.search.annotations.IndexedEmbedded; @Entity @Table(name = "TRIP_BILL") @@ -35,7 +38,7 @@ public class TripBill extends BaseData implements EntityWithAttachment { @Column(name = "SIGN_DATE") private Date signDate; - @Column(name = "RESULT_MESSAGE") + @Column(name = "RESULT_MESSAGE", length = Constants.LEN_RESULT_MESSAGE) @Field(index = Index.YES, analyze = Analyze.YES) private String resultMessage; diff --git a/src/main/java/info/bukova/isspst/services/dbinfo/DbInfoServiceImpl.java b/src/main/java/info/bukova/isspst/services/dbinfo/DbInfoServiceImpl.java index 72c5a3fc..60c60a6e 100644 --- a/src/main/java/info/bukova/isspst/services/dbinfo/DbInfoServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/dbinfo/DbInfoServiceImpl.java @@ -60,6 +60,9 @@ public class DbInfoServiceImpl extends AbstractService implements DbInfo } } + // String source = UserCountUtils.encryptUserCount(1000); + // long users = UserCountUtils.decryptUserCount(source); + long dbVersion = this.getDbInfo().getVersion(); if (Constants.DB_VERSION > dbVersion) @@ -133,6 +136,12 @@ public class DbInfoServiceImpl extends AbstractService implements DbInfo sq.executeUpdate(); } + if (dbVersion < 5) { + sql = "ALTER TABLE TRIP_BILL MODIFY RESULT_MESSAGE VARCHAR(" + String.valueOf(Constants.LEN_RESULT_MESSAGE) + ")"; + sq = this.dao.getSession().createSQLQuery(sql); + sq.executeUpdate(); + } + this.updateDatabaseVersion(); } }