1 Reply Latest reply on Mar 25, 2011 10:56 AM by Wolfgang Knauf

    Numeric values in varchar field & use enum ?

    Thomas Clifford Newbie



      An application sql table I'm working on has a varchar(4) field that, according to the information I had, is only supposed to

      hold two values, '0' or '1'. 

      I coded the value for that column as an enum in ejb3 previously, believing it would be specified in the database as

      a tinyint or int.  But the column has '1bbb' (b for blank), and none of them have '0bbb'.

      I've tried to code it in the enum as:


      0("0"), 1("1");


      which gave me a compile error, and also tried:


      "0"("0"), "1"("1");


      which also gave a compile error.


      Does anyone know if it's possible to code an enum such that a varchar field will hold numbers ?

      I've argued that the field should be a tinyint, but to no avail.  It's complicated.


      I believe I'll have to code it as a String in the ejb and associated beans.....