Announcement Announcement Module
Collapse
No announcement yet.
Default values Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    What data access API are you using (Hibernate, JDBC, JDO etc.)?

    Rob

    Comment


    • #3
      Originally posted by robh
      What data access API are you using (Hibernate, JDBC, JDO etc.)?

      Rob
      Hibernate.

      Comment


      • #4
        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

        Comment


        • #5
          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?

          Comment


          • #6
            OK thanks very much both of you.

            Comment

            Working...
            X