-
Type:
Bug
-
Resolution: Low Engagement
-
Priority:
Low
-
None
-
Affects Version/s: None
-
Component/s: None
-
Severity 3 - Minor
-
0
We used your utility method com.atlassian.bitbucket.ao.AoUtils#lengthFunction, unfortunately this method has a problem.
Function LEN in MS SQL doesn`t support some column types, in particular NTEXT.
If ao entity has a String type field with annotation @StringLength(UNLIMITED), the column with type NTEXT will be generated and throw an exeption when the function is called.
com.microsoft.sqlserver.jdbc.SQLServerException: Argument data type ntext is invalid for argument 1 of len function. com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:Microsoft SQL Server - version:11.00.6020 - minor version:0 - major version:11 Driver: - name:Microsoft JDBC Driver 6.0 for SQL Server - version:6.0.7507.100 com.microsoft.sqlserver.jdbc.SQLServerException: Argument data type ntext is invalid for argument 1 of len function. at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.stream(EntityManagedActiveObjects.java:166) ~[na:na] at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.stream(TenantAwareActiveObjects.java:316) ~[na:na]
To get the length for the type NTEXT it is necessary to use DATALENGTH function