Class Product

  • Direct Known Subclasses:
    Bread, Soup

    @Entity
    public abstract class Product
    extends Object
    This class provides an example base class in a single table inheritance strategy. In this case, a single table is defined to hold the properties of all sub-classes. A discriminator field is necessary to denote the type of each row in the table. Note that the primary key is being generated here since this class definition is shared among the sub-classes.
    • Field Detail

      • id

        private long id
      • cost

        private double cost
    • Constructor Detail

      • Product

        protected Product()
      • Product

        protected Product​(long id)
    • Method Detail

      • getId

        public long getId()
      • getCost

        public double getCost()
      • setCost

        public void setCost​(double cost)
      • getName

        public abstract String getName()