소스 정보
- 저장소
- sivaprasadreddy/sivalabs-marketplace
- 최근 소스 활동
- 2026년 1월 3일 07:40
- 감지된 SKILL.md 언어
- 영어
- 스타
- 47
- 포크
- 6
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/sivaprasadreddy/sivalabs-marketplace --skill jpa-entity-creator명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | jpa-entity-creator |
| description | Creates JPA entities following best practices. |
The following are key principles to follow while creating JPA entities:
@EmbeddedId annotation@Enumerated(EnumType.STRING) annotation@Embedded and @AttributeOverrides@VersionBaseEntity for audit fields(createdAt, updatedAt) and extend all entities from itTo use TSID, add the following dependency:
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-71</artifactId>
<version>3.14.1</version>
</dependency>
Now you can use TSID to generate IDs as follows:
import io.hypersistence.tsid.TSID;
public class IdGenerator {
private IdGenerator() {}
public static String generateString() {
return TSID.Factory.getTsid().toString();
}
public static Long generateLong() {
return TSID.Factory.getTsid().toLong();
}
}
public record EventId(String id) {
public EventId {
if (id == null || id.trim().isBlank()) {
throw new IllegalArgumentException("Event id cannot be null or empty");
}
}
public static EventId of(String id) {
return new EventId(id);
}
public static EventId generate() {
return new EventId(IdGenerator.generateString());
}
}
File: BaseEntity.java
import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import java.time.Instant;
@MappedSuperclass
public abstract class BaseEntity {
@Column(name = "created_at", nullable = false, updatable = false)
protected Instant createdAt;
@Column(name = "updated_at", nullable = false)
protected Instant updatedAt;
public Instant getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
public Instant getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt;
}
}
Create a AssertUtil class with static methods to validate input parameters.
public class AssertUtil {
private AssertUtil() {}
public static <T> T requireNotNull(T obj, String message) {
if (obj == null)
throw new IllegalArgumentException(message);
return obj;
}
}
While Creating a new JPA entity class, extend it from BaseEntity:
import jakarta.persistence.*;
import java.time.Instant;
@Entity
@Table(name = "events")
class EventEntity extends BaseEntity {
@EmbeddedId
@AttributeOverride(name = "id", column = @Column(name = "id", nullable = false))
private EventId id;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "title", column = @Column(name = "title", nullable = false)),
@AttributeOverride(name = "description", column = @Column(name = "description")),
@AttributeOverride(name = "imageUrl", column = @Column(name = "image_url"))
})
private EventDetails details;
@Enumerated(EnumType.STRING)
@Column(name = "event_type", nullable = false)
private EventType type;
//.. other fields
@Version
private int version;
// Protected constructor for JPA
protected EventEntity() {}
// Constructor with all required fields
public EventEntity(EventId id,
EventCode code,
EventDetails details,
Schedule schedule,
EventType type,
//...
EventLocation location) {
this.id = AssertUtil.requireNotNull(id, "Event id cannot be null");
this.code = AssertUtil.requireNotNull(code, "Event code cannot be null");
this.details = AssertUtil.requireNotNull(details, "Event details cannot be null");
this.schedule = AssertUtil.requireNotNull(schedule, );
.type = AssertUtil.requireNotNull(type, );
.location = AssertUtil.requireNotNull(location, );
}
EventEntity {
(
EventId.generate(),
EventCode.generate(),
details,
schedule,
type,
EventStatus.DRAFT,
ticketPrice,
capacity,
location);
}
{
capacity == || capacity.value() == || capacity.value() > registrationsCount;
}
{
status == EventStatus.PUBLISHED;
}
}