Results 1 to 3 of 3

Thread: Long or long ????

  1. #1

    Default Long or long ????

    in my domain classes

    shall i use Long or long to save long values ..

    actually when i am trying to get the data from database and if the value returned is null then an exception is thrown..

    if i am using String then its ok ... but i think thats not a good method ...

    can any one help me what to do here ...

    i have the same doubt with double values also ..

    if i am using wrapper classes i think ineed to register custom editiors for that ?????

    please help ...

    thanx

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    shall i use Long or long to save long values
    Long has the advantage of allowing nulls, which map to a null in the database, and also explicitly show whether the field has been bound to or not.

    if i am using wrapper classes i think ineed to register custom editiors for that ?????
    Depends if you need to customise behaviour (e.g. allow nulls). The existing CustomNumberEditor works for wrapper classes like Integer, Long, Float, Double.

  3. #3
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    I would always use Long the wrapper class for the primary keys and other significant columns (significant in the sense that they participate in some control logic). Modern JVMs are typically fairly efficient in allocating/gc small objects, so the price in performance is generally acceptable considering the benefits as katentim pointed out.
    --Jing Xue

Similar Threads

  1. Replies: 2
    Last Post: Sep 22nd, 2005, 04:11 PM
  2. Replies: 3
    Last Post: Sep 22nd, 2005, 10:14 AM
  3. Binding Long Values with CustomNumberEditor
    By chichirico in forum Web
    Replies: 0
    Last Post: Jun 21st, 2005, 11:02 AM
  4. Long lived locks
    By aaime in forum Swing
    Replies: 3
    Last Post: Mar 11th, 2005, 07:54 PM
  5. Remoting and long running processes
    By aaime in forum Remoting
    Replies: 13
    Last Post: Feb 24th, 2005, 05:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •