Results 1 to 6 of 6

Thread: Default values

  1. #1

    Default Default values

    I setup my database to insert some default values for rows.

    However (and I think this is correct behaviour) if the value is null in my object then it get's written as a null to the database and not the default.

    Is there anyway in my object I can tag a property to be "not defined" so the default gets inserted? Generally this would be for "not null" columns so a solution that said "treat nulls as undefined and insert the default" would work.

    Edward

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    What data access API are you using (Hibernate, JDBC, JDO etc.)?

    Rob

  3. #3

    Default

    Quote Originally Posted by robh
    What data access API are you using (Hibernate, JDBC, JDO etc.)?

    Rob
    Hibernate.

  4. #4
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Edward,

    Sorry to say, but I am not sure how you would go about doing that in Hibernate. I can find no reference to it whatsoever in the manual. I'm sure you are aware already, but Hibernate has a damn good forum - I suggest that you post this query there.

    Regards,

    Rob

  5. #5
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    Hibernate does not support default values, you should either manager this using database triggers or assign default values in your domain.
    how can I set default value of one column in x.hbm.xml file?
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  6. #6

    Default

    OK thanks very much both of you.

Similar Threads

  1. MySQL DDL
    By analogueboy in forum Security
    Replies: 5
    Last Post: Aug 17th, 2007, 03:48 PM
  2. default values with PropertyPlaceholderConfigurer
    By rwallace in forum Container
    Replies: 1
    Last Post: Jul 14th, 2005, 10:38 PM
  3. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  4. Replies: 2
    Last Post: May 5th, 2005, 09:35 PM
  5. Replies: 1
    Last Post: Apr 6th, 2005, 07:35 AM

Posting Permissions

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