diff --git a/active-record/src/main/java/com/iluwatar/activerecord/Order.java b/active-record/src/main/java/com/iluwatar/activerecord/Order.java index 4d77b90fcbe3..0e151bb11b93 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/Order.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/Order.java @@ -1,7 +1,9 @@ package com.iluwatar.activerecord; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -11,11 +13,26 @@ */ @Getter @Setter -@EqualsAndHashCode(onlyExplicitlyIncluded = true) @NoArgsConstructor @AllArgsConstructor -public class Order { +public class Order extends RecordBase { private Long id; private String orderNumber; + + @Override + protected String getTableName() { + return "order"; + } + + @Override + protected void setFieldsFromResultSet(ResultSet rs) throws SQLException { + this.id = rs.getLong("id"); + this.orderNumber = rs.getString("order_number"); + } + + @Override + protected void setPreparedStatementParams(PreparedStatement pstmt) throws SQLException { + // TODO + } } diff --git a/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java b/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java index c1b315b4d7b1..3cf974d207d1 100644 --- a/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java +++ b/active-record/src/main/java/com/iluwatar/activerecord/RecordBase.java @@ -13,6 +13,9 @@ /** * An active record base supposed to hold all the necessary active record pattern logic. + *

+ * This is the base class which is supposed to be extended by all the domain models that are + * expected to be persistent. * * @param an active record type. */