Use the @Enumerated(EnumType.STRING) annotation:

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

@Entity
public class ComparisonReport implements Serializable {

  public static final String TABLE_NAME = "T_COMPARISON_REPORT";
  public static final String COLUMN_TRIGGER_TYPE = "TRIGGER_TYPE";

  @Column(name = COLUMN_TRIGGER_TYPE)
  @Enumerated(EnumType.STRING)
  private ReportTriggerType triggerType;

 //others ignored for brevity
}

The enum itself looks something the following

public enum ReportTriggerType {
    MANUAL("MANUAL"),
    AUTOMATIC("AUTOMATIC");

    private String value;

    ReportTriggerType(String source) {
      this.value = source;
    }

    public String getValue() {
      return value;
    }
  }

Shared with from Codever.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

I usually set the date in the @PrePersist hook:

import javax.persistence.Entity;
import javax.persistence.PrePersist;
// others ignored for brevity


@Entity
public class ComparisonReport implements Serializable {

  public static final String TABLE_NAME = "T_COMPARISON_REPORT";
  public static final String COLUMN_CREATED_AT = "CREATED_AT";

  @Column(name = COLUMN_CREATED_AT)
  private LocalDateTime createdAt;

@PrePersist
  protected void prePersist() {
    if (this.createdAt == null) createdAt = LocalDateTime.now();
  }
 //others ignored for brevity
}

Shared with from Codever.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Project: codever - File: howto-get-started.component.scss

Set margin-left and margin-right to auto to align in center of the page/div and text-align to align the text and image inside of the table headers and cells:

.extensions-table {
  margin-left: auto;
  margin-right: auto;
  th, td {
    width: 8rem;
    text-align: center;
  }
}
Continue Reading ...

Project: codever

Use the @extend directive. In this case the border style is inherited:

.last-search-border {
  border-width: 0.05rem;
  border-style: solid;
  border-color: #495057;
}

.public-bookmarks-last-search {
  @extend .last-search-border;
  background: #f0f2f5;
  color: black;
}

.my-bookmarks-last-search {
  @extend .last-search-border;
  background: linen;
  color: #495057;
}

Reference - https://sass-lang.com/documentation/at-rules/extend


Shared with from Codever.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Use case

I thought it would be practical to be able to search for search snippets directly from IntelliJ, without having to go to the browser, something like in the following demo:

IntelliJ Plugin - Search snippet from IDE demo
IntelliJ Plugin - Search snippet from IDE demo

The implementation is fairly easy, so let’s see how it’s done.

Continue Reading ...