Issue Details (XML | Word | Printable)

Key: TORQUE-80
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Thomas Fischer
Reporter: Brian Telintelo
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Torque

Default Values with an empty string in the schema results in bad source generation for number types

Created: 27/Jan/07 11:58 PM   Updated: 02/Feb/07 09:52 PM
Return to search
Component/s: Generator
Affects Version/s: None
Fix Version/s: 3.3

Time Tracking:
Not Specified

Resolution Date: 02/Feb/07 09:52 PM


 Description  « Hide
Using a mysql database, a data type that is numerical, but has no default value results in the schema generation to have default="". This causes the om generator to create java file that are declared like int customerID = ; This causes a compile error.

To fix, just change org.apache.torque.task.TorqueJDBCTransformTask line 308 from

if (defValue1 != null)

to

if (StringUtils.isNotEmpty(defValue))

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Brian Telintelo made changes - 28/Jan/07 05:23 AM
Field Original Value New Value
Description Using a mysql database, a data type that is numerical, but has no default value results in the schema generation to have default="". This causes the om generator to create java file that are declared like int customerID = ; This causes a compile error.

To fix, just change org.apache.torque.task. line 308 from

if (defValue1 != null)

to

if (StringUtils.isNotEmpty(defValue))
Using a mysql database, a data type that is numerical, but has no default value results in the schema generation to have default="". This causes the om generator to create java file that are declared like int customerID = ; This causes a compile error.

To fix, just change org.apache.torque.task.TorqueJDBCTransformTask line 308 from

if (defValue1 != null)

to

if (StringUtils.isNotEmpty(defValue))
Repository Revision Date User Message
ASF #502761 Fri Feb 02 21:52:05 UTC 2007 tfischer In the JDBCTransformTask in the generator, only add the attribute "default" to the column description in the generated schema if its value is not empty.
Fixes TORQUE-80
Thanks to Brian Telintelo for the patch.
Files Changed
MODIFY /db/torque/site/trunk/xdocs/changes.xml
MODIFY /db/torque/generator/trunk/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java

Thomas Fischer added a comment - 02/Feb/07 09:52 PM
Patch applied. Thanks a lot.

Thomas Fischer made changes - 02/Feb/07 09:52 PM
Fix Version/s 3.3 [ 12310991 ]
Status Open [ 1 ] Closed [ 6 ]
Assignee Thomas Fischer [ tfischer ]
Resolution Fixed [ 1 ]