Class User

java.lang.Object
com.goldenleaf.shop.model.User
Direct Known Subclasses:
Admin, Customer

@Entity public abstract class User extends Object
Abstract base entity representing a user in the system.

This is the root of a InheritanceType.JOINED inheritance hierarchy. Concrete user types such as Customer and Admin extend this class. Common fields are stored in the users table, while type-specific columns are stored in their own dedicated tables.

The login field is unique across all user types and is used as the primary credential identifier. The passwordHash stores the hashed password (e.g. BCrypt). The lastActivity field is updated on every successful login or meaningful action.

Since:
1.0.0
See Also:
  • Constructor Details

    • User

      public User()
      Default constructor required by JPA.
    • User

      public User(String login, String passwordHash, String name, LocalDate lastActivity)
      Convenience constructor for creating a new user instance.
      Parameters:
      login - unique login
      passwordHash - already hashed password
      name - display name
      lastActivity - date of last activity (usually LocalDate.now() on creation)
      Throws:
      EmptyLoginException - if login is blank
      EmptyLastActivityException - if lastActivity is null
  • Method Details