Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0beta2
    • Fix Version/s: 3.0beta3
    • Component/s: annotations (obsolete)
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      Get following error:

      [java] Caused by: java.sql.SQLException: Try to insert null into a non-nullable column: column: NUMBONES table: PET in statement [insert into Pet (name, weight, lives, ANIMAL_TYPE, id) values (?, ?, ?, 'CAT', null)]
      [java] at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source)
      [java] at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
      [java] at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:316)
      [java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1773)

      From this code.

      This used to work.

      @Entity
      @Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING)
      @DiscriminatorColumn(name = "ANIMAL_TYPE", nullable = true)
      public class Pet implements java.io.Serializable
      {
      private int id;
      private String name;
      private double weight;

      @Id(generate = GeneratorType.AUTO)
      public int getId()

      { return id; }

      public void setId(int id)

      { this.id = id; }

      public String getName()

      { return name; }

      public void setName(String name)

      { this.name = name; }

      public double getWeight()

      { return weight; }

      public void setWeight(double weight)

      { this.weight = weight; }

      }

      @Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING, discriminatorValue = "DOG")
      public class Dog extends Pet
      {
      private int numBones;

      public int getNumBones()

      { return numBones; }

      public void setNumBones(int numBones)

      { this.numBones = numBones; }

      }

      @Entity
      @Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING, discriminatorValue = "CAT")
      public class Cat extends Pet
      {
      int lives;

      public int getLives()

      { return lives; }

      public void setLives(int lives)

      { this.lives = lives; }

      }

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Stride room